# AngelScript variable decomposition

This topic is 2716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hello, i'v got a question
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?

##### Share on other sites
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).

##### Share on other sites

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...

• 11
• 20
• 12
• 10
• 35
• ### Forum Statistics

• Total Topics
631399
• Total Posts
2999857
×