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