Functions


Defines

#define asFUNCTION(f)   asFunctionPtr(f)
 Returns an asSFuncPtr representing the function specified by the name.
#define asFUNCTIONPR(f, p, r)   asFunctionPtr((void (*)())((r (*)p)(f)))
 Returns an asSFuncPtr representing the function specified by the name, parameter list, and return type.
#define asMETHOD(c, m)   asSMethodPtr<sizeof(void (c::*)())>::Convert((void (c::*)())(&c::m))
 Returns an asSFuncPtr representing the class method specified by class and method name.
#define asMETHODPR(c, m, p, r)   asSMethodPtr<sizeof(void (c::*)())>::Convert((r (c::*)p)(&c::m))
 Returns an asSFuncPtr representing the class method specified by class, method name, parameter list, return type.

Functions

AS_API asIScriptEngineasCreateScriptEngine (asDWORD version)
 Creates the script engine.
AS_API const char * asGetLibraryVersion ()
 Returns the version of the compiled library.
AS_API const char * asGetLibraryOptions ()
 Returns the options used to compile the library.
AS_API asIScriptContextasGetActiveContext ()
 Returns the currently active context.
AS_API int asThreadCleanup ()
 Cleans up memory allocated for the current thread.
AS_API int asSetGlobalMemoryFunctions (asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc)
 Set the memory management functions that AngelScript should use.
AS_API int asResetGlobalMemoryFunctions ()
 Remove previously registered memory management functions.

Function Documentation

AS_API asIScriptEngine* asCreateScriptEngine ( asDWORD  version  ) 

Parameters:
[in] version The library version. Should always be ANGELSCRIPT_VERSION.
Returns:
A pointer to the script engine interface.
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 Release on the pointer to free the engine object.

AS_API asIScriptContext* asGetActiveContext (  ) 

Returns:
A pointer to the currently executing context, or null if no context is executing.
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.

AS_API const char* asGetLibraryOptions (  ) 

Returns:
A null terminated string with indicators that identify the options used to compile the script library.
This can be used to identify at run-time different ways to configure the engine. For example, if the returned string contain the identifier AS_MAX_PORTABILITY then functions and methods must be registered with the asCALL_GENERIC calling convention.

AS_API const char* asGetLibraryVersion (  ) 

Returns:
A null terminated string with the library version.
The returned string can be used for presenting the library version in a log file, or in the GUI.

AS_API int asResetGlobalMemoryFunctions (  ) 

Returns:
A negative value on error.
Call this method to restore the default memory management functions.

AS_API int asSetGlobalMemoryFunctions ( asALLOCFUNC_t  allocFunc,
asFREEFUNC_t  freeFunc 
)

Parameters:
[in] allocFunc The function that will be used to allocate memory.
[in] freeFunc The function that will be used to free the memory.
Returns:
A negative value on error.
Call this method to register the global memory allocation and deallocation functions that AngelScript should use for memory management. This function Should be called before asCreateScriptEngine.

If not called, AngelScript will use the malloc and free functions from the standard C library.

AS_API int asThreadCleanup (  ) 

Returns:
A negative value on error.
Return values:
asCONTEXT_ACTIVE A context is still active.
Call this method before terminating a thread that has accessed the engine to clean up memory allocated for that thread.

It's not necessary to call this if only a single thread accesses the engine.


Generated on Sat Mar 22 21:26:28 2008 for AngelScript by  doxygen 1.5.5