]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - misc/source/gmqcc-src/tests/varargs.qc
By fteqcc, hello gmqcc
[voretournament/voretournament.git] / misc / source / gmqcc-src / tests / varargs.qc
diff --git a/misc/source/gmqcc-src/tests/varargs.qc b/misc/source/gmqcc-src/tests/varargs.qc
new file mode 100644 (file)
index 0000000..4b0d806
--- /dev/null
@@ -0,0 +1,20 @@
+void nbva(float a, string...count) {
+    print("You gave me ", ftos(count), " additional parameters\n");
+    print("First: ", ...(0, string), "\n");
+    print("You chose: ", ...(a, string), "\n");
+    for (a = 0; a < count; ++a)
+        print("Vararg ", ftos(a), " = ", ...(a, string), "\n");
+}
+
+var void unstable(...);
+void stability(float a, float b, ...count)
+{
+    print("Got: ", ftos(count), "\n");
+}
+
+void main() {
+    nbva(1, "Hello", "You", "There");
+    stability(1, 2, 3, 4, 5);
+    unstable = stability;
+    unstable(1, 2, 3, 4, 5);
+}