Advertisement

Reset all global handlers to null

Started by January 31, 2012 07:17 AM
1 comment, last by WitchLord 12 years, 10 months ago
Hello Andreas,

I've got another question for you :)

Due to some particularly tricky integration with another library we would like to be able to reset from the C++ all global AS handler variables to null. That would allow automatic release of reference counted resources in that external library. How can we do that?
Ugh, somehow missed
virtual int ResetGlobalVars (asIScriptContext *ctx=0)=0
in the documentation. I guess this is what I need for my purposes (in case it also properly calls ->Release on the vars).
Advertisement
That function will properly release the handles, and then initialize them using their default values assigned when the module was first compiled.

If you want finer control you need to enumerate the global variables, and reset the ones you want. Use the modules GetGlobalVarCount, GetGlobalVar, and GetAddressOfGlobalVar. The latter will give you a pointer to the handle. Call Release on the object, and then set the handle to 0.

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