Advertisement

AngelScript variable decomposition

Started by January 13, 2011 06:23 PM
2 comments, last by WitchLord 13 years, 10 months ago
hello, i'v got a question :D
for example we have code

int a=5;
int b=a*7;
int c=(a*7)*a-b;
int d=b+c;

and i want to execute this string

int test=c+b;


is there any way to get from angel script information about all variables, that is associated with script string[a,b,c] without accessing private data of angelscript?
Crazy dude smoking D3D11, AngelScript, PhysX, 3D Sound, Network, DB, FBX, and some other weird things, doing that on Visual Studio 2010 + Visual Assist X on Overclocked CPU
Not quite sure what you're looking for, but yes, it is possible to enumerate variables and their values through the interfaces. For global variables in script modules you'll use the asIScriptModule interface, specifically the GetGlobalVarCount, GetGlobalVar, and GetAddressOfGlobalVar methods. For local variables in script functions you'll use the asIScriptContext interface, specifically the GetVarCount, GetVarName, and GetAddressOfVar methods. Of course, for local variables you'll need to execute the script and access the variables when you're in the function (either by suspending the context, or accessing them from the line callback, or even from an application registered function called from the script function).

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

Not quite sure what you're looking for, but yes, it is possible to enumerate variables and their values through the interfaces. For global variables in script modules you'll use the asIScriptModule interface, specifically the GetGlobalVarCount, GetGlobalVar, and GetAddressOfGlobalVar methods. For local variables in script functions you'll use the asIScriptContext interface, specifically the GetVarCount, GetVarName, and GetAddressOfVar methods. Of course, for local variables you'll need to execute the script and access the variables when you're in the function (either by suspending the context, or accessing them from the line callback, or even from an application registered function called from the script function).


i'm looking for enumerating variables, that are used in during script execution.
it's like, when you execute script on as vm u get the values from internal tables of the variables the script gonna use.
i need some hook for that variables or any other method to get them.
i'm doing this because i have 760 values from DB, that has about 1500000 pages of data, and loading every variable into angelscript is very costly, because of that i need to only load the variables that are gonna be USED during script execution.

p.s. i guess i keep trying...
Crazy dude smoking D3D11, AngelScript, PhysX, 3D Sound, Network, DB, FBX, and some other weird things, doing that on Visual Studio 2010 + Visual Assist X on Overclocked CPU
Perhaps the article on debugging scripts</a> may be of help to you.

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