RegisterGlobalProperty in 2.13.00
It seems that registering a global property in AS is a problem to me.
int KB_SPACE = 57;
r = ScriptEngine->RegisterGlobalProperty("int KB_SPACE",&KB_SPACE); assert(r>=0);
output in screen:
<br/>
It outputs 258? How is it possible?
And I checked few times, it seems like not my mistake (or is it?).
The call to RegisterGlobalProperty is correct.
But it seems that the value that the address points to changes. Is the KB_SPACE variable in a global scope? Or is it a local variable? AngelScript stores the address of the variable, so you must make sure the variable stays valid for the duration of the script engine.
Perhaps you have some memory invasion somewhere. Have you tried setting a breakpoint to determine where the value of KB_SPACE changes?
Regards,
Andreas
But it seems that the value that the address points to changes. Is the KB_SPACE variable in a global scope? Or is it a local variable? AngelScript stores the address of the variable, so you must make sure the variable stays valid for the duration of the script engine.
Perhaps you have some memory invasion somewhere. Have you tried setting a breakpoint to determine where the value of KB_SPACE changes?
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