Any way to get a script global var.
Hi,
I know that i can use RegisterGlobalProperty to define a global var on script, but why cant access to Global vars defines on script will be usefull for config files and other stuff.
Gunder.
This is planned. I might even be able to include in version 1.8.0, because it is quite easy to implement now with the changes I made for 1.7.0.
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Was this put into AngelScript? If so, can you tell me what it is called?
Wow, this was one old topic.
Yes, you can enumerate the global variables in the compiled script modules.
[code]
asIScriptModule *mod = engine->GetModule("MyModule");
for( unsigned int n = 0; n < mod->GetGlobalVarCount(); n++ )
{
const char *name;
int typeId;
mod->GetGlobalVar(n, name, typeId);
void *ptr = mod->GetAddressOfGlobalVar(n);
// depending the type id, reinterpret_cast the pointer
// to the correct type and use the value as needed
}
[/code]
Regards,
Andreas
Yes, you can enumerate the global variables in the compiled script modules.
[code]
asIScriptModule *mod = engine->GetModule("MyModule");
for( unsigned int n = 0; n < mod->GetGlobalVarCount(); n++ )
{
const char *name;
int typeId;
mod->GetGlobalVar(n, name, typeId);
void *ptr = mod->GetAddressOfGlobalVar(n);
// depending the type id, reinterpret_cast the pointer
// to the correct type and use the value as needed
}
[/code]
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement