]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
fields: testing function-fields
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 18 Aug 2012 12:50:30 +0000 (14:50 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 18 Aug 2012 12:50:30 +0000 (14:50 +0200)
data/fields.qc

index 379f4287f7ff70eaf8cb6285962b11df9cbe2e50..7c29959487dc5dcef9d3d9393cb2020b530c958b 100644 (file)
@@ -12,10 +12,17 @@ void(entity)        kill   = #4;
 .float memb;
 .vector memv;
 
+.void() fun;
+
 void(entity a, .float f) printfield = {
+    ftos(3+4);
     print3("The field is ", ftos(a.f), "\n");
 };
 
+void() funny = {
+    print("FUNNY\n");
+};
+
 void() main = {
     entity pawn;
 
@@ -35,4 +42,8 @@ void() main = {
     print3("y = ", ftos(pawn.memv_y), "\n");
     print3("z = ", ftos(pawn.memv_z), "\n");
     printfield(pawn, memv_z);
+
+    pawn.fun = funny;
+
+    (pawn.fun)();
 };