Sign in to follow this  

Host app access to AS variables

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

The engine interface provides the following methods for accessing globally declared script variables:


// Script global variables
virtual int GetGlobalVarCount(const char *module) = 0;
virtual int GetGlobalVarIDByIndex(const char *module, int index) = 0;
virtual int GetGlobalVarIDByName(const char *module, const char *name) = 0;
virtual int GetGlobalVarIDByDecl(const char *module, const char *decl) = 0;
virtual int GetGlobalVarDeclaration(int gvarID, char *buffer, int bufferSize) = 0;
virtual int GetGlobalVarName(int gvarID, char *buffer, int bufferSize) = 0;
virtual int GetGlobalVarPointer(int gvarID, void **pointer) = 0;



If you know the type and name of the variable you can get the id with GetGlobalVarIDByDecl() then use GetGlobalVarPointer() to get a pointer to the memory where the variable is located. If you don't know the variables or their types use the other methods for retrieving that info.

Share this post


Link to post
Share on other sites
The host application doesn't have direct access to the script context stacks. It wouldn't be of much use anyway since the script doesn't store the type of the local variables on the stack.

The application can get information on where in the code the script execution is currently located at. There are functions for getting which module, function, and line that is being executed. The code can also be stepped through, line by line.

What exactly do you want to do? If you explain to me I might be able to help you. I might even be able to change AngelScript to include the feature you need if it doesn't have it already.

Share this post


Link to post
Share on other sites
My intentions for angelscript are to be able to allow a person to write a script, and while the script is executing, have a real time display of a combination of user defined script variables and host app variables, and the display of which be designated by the user through a simple interface.

Share this post


Link to post
Share on other sites
It's possible for me to give access to the stack used by a function, and even the list of functions called up until current execution point.

However, I can't give you information about what type of data is stored at each position in the stack, nor the name of the variable. This information simply isn't stored anywhere. Some positions even store more than one variable in the same functions (at different times though).

Maybe I could alter the library to store the name, type, and position of each variable used in the functions, and then allow the application to access this information. However, I'm afraid that I'll have to give this quite a low priority. If you wish to do the alteration yourself though, I might be able to include your changes in the main library code afterwards.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this