]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
debug: bufstr_get command
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 4 Dec 2015 06:43:41 +0000 (17:43 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Fri, 4 Dec 2015 06:43:41 +0000 (17:43 +1100)
qcsrc/common/debug.qh

index 25dc11d1c391f2e2e1907cb0a868dd47f1169371..5ead52479d9efda26f400c984c566edb1b23060e 100644 (file)
@@ -111,4 +111,26 @@ bool autocvar_debugdraw;
        }
 #endif
 
+GENERIC_COMMAND(bufstr_get, "Examine a string buffer object")
+{
+       switch (request)
+       {
+               case CMD_REQUEST_COMMAND:
+               {
+                   int bufhandle = stof(argv(1));
+                   int string_index = stof(argv(2));
+                       string s = bufstr_get(bufhandle, string_index);
+                       LOG_INFOF("%s\n", s);
+                       return;
+               }
+
+               default:
+               case CMD_REQUEST_USAGE:
+               {
+                       LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " bufstr_get bufhandle string_index"));
+                       return;
+               }
+       }
+}
+
 #endif