]> de.git.xonotic.org Git - xonotic/gmqcc.git/blob - tests/varargs.qc
4b0d80686e079be78b63f3c0a2f95e0768062a83
[xonotic/gmqcc.git] / tests / varargs.qc
1 void nbva(float a, string...count) {
2     print("You gave me ", ftos(count), " additional parameters\n");
3     print("First: ", ...(0, string), "\n");
4     print("You chose: ", ...(a, string), "\n");
5     for (a = 0; a < count; ++a)
6         print("Vararg ", ftos(a), " = ", ...(a, string), "\n");
7 }
8
9 var void unstable(...);
10 void stability(float a, float b, ...count)
11 {
12     print("Got: ", ftos(count), "\n");
13 }
14
15 void main() {
16     nbva(1, "Hello", "You", "There");
17     stability(1, 2, 3, 4, 5);
18     unstable = stability;
19     unstable(1, 2, 3, 4, 5);
20 }