Functions | |
AS_API asIScriptEngine * | asCreateScriptEngine (asDWORD version=ANGELSCRIPT_VERSION) |
Creates the script engine. More... | |
AS_API asIScriptContext * | asGetActiveContext () |
Returns the currently active context. More... | |
template<typename T > | |
asUINT | asGetTypeTraits () |
Returns the appropriate flags for use with RegisterObjectType. More... | |
AS_API asIScriptEngine* asCreateScriptEngine | ( | asDWORD | version = ANGELSCRIPT_VERSION | ) |
[in] | version | The library version. Should always be ANGELSCRIPT_VERSION. |
Call this function to create a new script engine. When you're done with the script engine, i.e. after you've executed all your scripts, you should call ShutDownAndRelease on the pointer to cleanup any objects that may still be alive and free the engine object.
The version argument is there to allow AngelScript to validate that the application has been compiled with the correct interface. This is especially important when linking dynamically against the library. If the version is incorrect a null pointer is returned.
AS_API asIScriptContext* asGetActiveContext | ( | ) |
This function is most useful for registered functions, as it will allow them to obtain a pointer to the context that is calling the function, and through that get the engine, or custom user data.
If the script library is compiled with multithread support, this function will return the context that is currently active in the thread that is being executed. It will thus work even if there are multiple threads executing scripts at the same time.
This function does not increase the reference count of the context.
asUINT asGetTypeTraits | ( | ) |
T | The type for which the flags should be determined |
This template function uses C++11 STL template functions to determine the appropriate flags to use when registering the desired type as a value type with asIScriptEngine::RegisterObjectType.
It is capable to determine all the asOBJ_APP_xxx flags, except for asOBJ_APP_CLASS_ALLINTS, asOBJ_APP_CLASS_ALLFLOATS, and asOBJ_APP_CLASS_ALIGN8. These flags must still be informed manually when needed.