MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / ListVariables

Function ListVariables

src/server/angelscript/samples/console/source/main.cpp:306–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306void ListVariables(asIScriptEngine *engine)
307{
308 asUINT n;
309
310 // List the application registered variables
311 cout << "Application variables:" << endl;
312 for( n = 0; n < (asUINT)engine->GetGlobalPropertyCount(); n++ )
313 {
314 const char *name;
315 int typeId;
316 bool isConst;
317 engine->GetGlobalPropertyByIndex(n, &name, 0, &typeId, &isConst);
318 string decl = isConst ? " const " : " ";
319 decl += engine->GetTypeDeclaration(typeId);
320 decl += " ";
321 decl += name;
322 cout << decl << endl;
323 }
324
325 // List the user variables in the module
326 asIScriptModule *mod = engine->GetModule("console");
327 if( mod )
328 {
329 cout << endl;
330 cout << "User variables:" << endl;
331 for( n = 0; n < (asUINT)mod->GetGlobalVarCount(); n++ )
332 {
333 cout << " " << mod->GetGlobalVarDeclaration(n) << endl;
334 }
335 }
336}
337
338void ListFunctions(asIScriptEngine *engine)
339{

Callers 1

mainFunction · 0.85

Calls 6

GetTypeDeclarationMethod · 0.80
GetGlobalVarCountMethod · 0.80
GetModuleMethod · 0.45

Tested by

no test coverage detected