# angelscript.h File Reference

The API definition for AngelScript. More...

## Classes
struct | asSFuncPtr
| Represents a function or method pointer. More...
struct | asSMessageInfo
| Represents a compiler message. More...
class | asIScriptEngine
| The engine interface. More...
class | asIScriptModule
| The interface to the script modules. More...
class | asIScriptContext
| The interface to the virtual machine. More...
class | asIScriptGeneric
| The interface for the generic calling convention. More...
class | asIScriptObject
| The interface for an instance of a script object. More...
class | asIScriptArray
| The interface for a script array object. More...
class | asIObjectType
| The interface for an object type. More...
class | asIScriptFunction
| The interface for a script function description. More...
class | asIBinaryStream
| A binary stream interface. More...
struct | asSVMRegisters
| A struct with registers from the VM sent to a JIT compiled function. More...
class | asIJITCompiler
| The interface that AS use to interact with the JIT compiler. More...
struct | asSBCInfo
| Information on a bytecode instruction. More...
## Defines
#define | ANGELSCRIPT_VERSION 21800
#define | asFUNCTION(f) asFunctionPtr(f)
| Returns an asSFuncPtr representing the function specified by the name.
#define | asFUNCTIONPR(f, p, r) asFunctionPtr((void (*)())(static_cast<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(static_cast<r (c::*)p>(&c::m))
| Returns an asSFuncPtr representing the class method specified by class, method name, parameter list, return type.
#define | AS_API
| A define that specifies how the function should be imported.
#define | asBC_DWORDARG(x) (asDWORD(*(x+1)))
| Macro to access the first DWORD argument in the bytecode instruction.
#define | asBC_INTARG(x) (int(*(x+1)))
| Macro to access the first 32bit integer argument in the bytecode instruction.
#define | asBC_QWORDARG(x) (*(asQWORD*)(x+1))
| Macro to access the first QWORD argument in the bytecode instruction.
#define | asBC_FLOATARG(x) (*(float*)(x+1))
| Macro to access the first float argument in the bytecode instruction.
#define | asBC_PTRARG(x) (asPTRWORD(*(x+1)))
| Macro to access the first pointer argument in the bytecode instruction.
#define | asBC_WORDARG0(x) (*(((asWORD*)x)+1))
| Macro to access the first WORD argument in the bytecode instruction.
#define | asBC_WORDARG1(x) (*(((asWORD*)x)+2))
| Macro to access the second WORD argument in the bytecode instruction.
#define | asBC_SWORDARG0(x) (*(((short*)x)+1))
| Macro to access the first signed WORD argument in the bytecode instruction.
#define | asBC_SWORDARG1(x) (*(((short*)x)+2))
| Macro to access the second signed WORD argument in the bytecode instruction.
#define | asBC_SWORDARG2(x) (*(((short*)x)+3))
| Macro to access the third signed WORD argument in the bytecode instruction.
## Typedefs
typedef unsigned char | asBYTE
| 8 bit unsigned integer
typedef unsigned short | asWORD
| 16 bit unsigned integer
typedef unsigned int | asUINT
| 32 bit unsigned integer
typedef size_t | asPWORD
| Unsigned integer with the size of a pointer.
typedef unsigned long | asDWORD
| 32 bit unsigned integer
typedef unsigned __int64 | asQWORD
| 64 bit unsigned integer
typedef __int64 | asINT64
| 64 bit integer
typedef void *(* | asALLOCFUNC_t )(size_t)
| The function signature for the custom memory allocation function.
typedef void(* | asFREEFUNC_t )(void *)
| The function signature for the custom memory deallocation function.
typedef void(* | asJITFunction )(asSVMRegisters *registers, asDWORD entryId)
| The function signature of a JIT compiled function.
## Enumerations
enum | asEEngineProp { asEP_ALLOW_UNSAFE_REFERENCES = 1, asEP_OPTIMIZE_BYTECODE = 2, asEP_COPY_SCRIPT_SECTIONS = 3, asEP_MAX_STACK_SIZE = 4, asEP_USE_CHARACTER_LITERALS = 5, asEP_ALLOW_MULTILINE_STRINGS = 6, asEP_ALLOW_IMPLICIT_HANDLE_TYPES = 7, asEP_BUILD_WITHOUT_LINE_CUES = 8, asEP_INIT_GLOBAL_VARS_AFTER_BUILD = 9, asEP_REQUIRE_ENUM_SCOPE = 10, asEP_SCRIPT_SCANNER = 11, asEP_INCLUDE_JIT_INSTRUCTIONS = 12, asEP_STRING_ENCODING = 13 }
| Engine properties. More...
enum | asECallConvTypes { asCALL_CDECL = 0, asCALL_STDCALL = 1, asCALL_THISCALL = 2, asCALL_CDECL_OBJLAST = 3, asCALL_CDECL_OBJFIRST = 4, asCALL_GENERIC = 5 }
| Calling conventions. More...
enum | asEObjTypeFlags { asOBJ_REF = 0x01, asOBJ_VALUE = 0x02, asOBJ_GC = 0x04, asOBJ_POD = 0x08, asOBJ_NOHANDLE = 0x10, asOBJ_SCOPED = 0x20, asOBJ_TEMPLATE = 0x40, asOBJ_APP_CLASS = 0x100, asOBJ_APP_CLASS_CONSTRUCTOR = 0x200, asOBJ_APP_CLASS_DESTRUCTOR = 0x400, asOBJ_APP_CLASS_ASSIGNMENT = 0x800, asOBJ_APP_CLASS_C = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR), asOBJ_APP_CLASS_CD = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR), asOBJ_APP_CLASS_CA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT), asOBJ_APP_CLASS_CDA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_CONSTRUCTOR + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT), asOBJ_APP_CLASS_D = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR), asOBJ_APP_CLASS_A = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_ASSIGNMENT), asOBJ_APP_CLASS_DA = (asOBJ_APP_CLASS + asOBJ_APP_CLASS_DESTRUCTOR + asOBJ_APP_CLASS_ASSIGNMENT), asOBJ_APP_PRIMITIVE = 0x1000, asOBJ_APP_FLOAT = 0x2000 , asOBJ_SCRIPT_OBJECT = 0x10000 }
| Object type flags. More...
enum | asEBehaviours { asBEHAVE_CONSTRUCT, asBEHAVE_DESTRUCT, asBEHAVE_FACTORY, asBEHAVE_ADDREF, asBEHAVE_RELEASE, asBEHAVE_VALUE_CAST, asBEHAVE_IMPLICIT_VALUE_CAST, asBEHAVE_REF_CAST, asBEHAVE_IMPLICIT_REF_CAST, asBEHAVE_INDEX, asBEHAVE_TEMPLATE_CALLBACK , asBEHAVE_GETREFCOUNT = asBEHAVE_FIRST_GC, asBEHAVE_SETGCFLAG, asBEHAVE_GETGCFLAG, asBEHAVE_ENUMREFS, asBEHAVE_RELEASEREFS }
| Behaviours. More...
enum | asERetCodes { asSUCCESS = 0, asERROR = -1, asCONTEXT_ACTIVE = -2, asCONTEXT_NOT_FINISHED = -3, asCONTEXT_NOT_PREPARED = -4, asINVALID_ARG = -5, asNO_FUNCTION = -6, asNOT_SUPPORTED = -7, asINVALID_NAME = -8, asNAME_TAKEN = -9, asINVALID_DECLARATION = -10, asINVALID_OBJECT = -11, asINVALID_TYPE = -12, asALREADY_REGISTERED = -13, asMULTIPLE_FUNCTIONS = -14, asNO_MODULE = -15, asNO_GLOBAL_VAR = -16, asINVALID_CONFIGURATION = -17, asINVALID_INTERFACE = -18, asCANT_BIND_ALL_FUNCTIONS = -19, asLOWER_ARRAY_DIMENSION_NOT_REGISTERED = -20, asWRONG_CONFIG_GROUP = -21, asCONFIG_GROUP_IS_IN_USE = -22, asILLEGAL_BEHAVIOUR_FOR_TYPE = -23, asWRONG_CALLING_CONV = -24, asBUILD_IN_PROGRESS = -25, asINIT_GLOBAL_VARS_FAILED = -26 }
| Return codes. More...
enum | asEContextState { asEXECUTION_FINISHED = 0, asEXECUTION_SUSPENDED = 1, asEXECUTION_ABORTED = 2, asEXECUTION_EXCEPTION = 3, asEXECUTION_PREPARED = 4, asEXECUTION_UNINITIALIZED = 5, asEXECUTION_ACTIVE = 6, asEXECUTION_ERROR = 7 }
| Context states. More...
enum | asEExecStrFlags { asEXECSTRING_ONLY_PREPARE = 1, asEXECSTRING_USE_MY_CONTEXT = 2 }
| ExecuteString flags. More...
enum | asEMsgType { asMSGTYPE_ERROR = 0, asMSGTYPE_WARNING = 1, asMSGTYPE_INFORMATION = 2 }
| Compiler message types. More...
enum | asEGCFlags { asGC_FULL_CYCLE = 1, asGC_ONE_STEP = 2, asGC_DESTROY_GARBAGE = 4, asGC_DETECT_GARBAGE = 8 }
| Garbage collector flags. More...
enum | asETokenClass { asTC_UNKNOWN = 0, asTC_KEYWORD = 1, asTC_VALUE = 2, asTC_IDENTIFIER = 3, asTC_COMMENT = 4, asTC_WHITESPACE = 5 }
| Token classes. More...
enum | asETypeIdFlags { asTYPEID_VOID = 0, asTYPEID_BOOL = 1, asTYPEID_INT8 = 2, asTYPEID_INT16 = 3, asTYPEID_INT32 = 4, asTYPEID_INT64 = 5, asTYPEID_UINT8 = 6, asTYPEID_UINT16 = 7, asTYPEID_UINT32 = 8, asTYPEID_UINT64 = 9, asTYPEID_FLOAT = 10, asTYPEID_DOUBLE = 11, asTYPEID_OBJHANDLE = 0x40000000, asTYPEID_HANDLETOCONST = 0x20000000, asTYPEID_MASK_OBJECT = 0x1C000000, asTYPEID_APPOBJECT = 0x04000000, asTYPEID_SCRIPTOBJECT = 0x08000000, asTYPEID_SCRIPTARRAY = 0x10000000, asTYPEID_MASK_SEQNBR = 0x03FFFFFF }
| Type id flags. More...
enum | asETypeModifiers { asTM_NONE = 0, asTM_INREF = 1, asTM_OUTREF = 2, asTM_INOUTREF = 3 }
| Type modifiers. More...
enum | asEGMFlags { asGM_ONLY_IF_EXISTS = 0, asGM_CREATE_IF_NOT_EXISTS = 1, asGM_ALWAYS_CREATE = 2 }
| Flags for GetModule. More...
enum | asECompileFlags { asCOMP_ADD_TO_MODULE = 1 }
| Flags for compilation. More...
enum | asEBCInstr { asBC_POP = 0, asBC_PUSH = 1, asBC_PshC4 = 2, asBC_PshV4 = 3, asBC_PSF = 4, asBC_SWAP4 = 5, asBC_NOT = 6, asBC_PshG4 = 7, asBC_LdGRdR4 = 8, asBC_CALL = 9, asBC_RET = 10, asBC_JMP = 11, asBC_JZ = 12, asBC_JNZ = 13, asBC_JS = 14, asBC_JNS = 15, asBC_JP = 16, asBC_JNP = 17, asBC_TZ = 18, asBC_TNZ = 19, asBC_TS = 20, asBC_TNS = 21, asBC_TP = 22, asBC_TNP = 23, asBC_NEGi = 24, asBC_NEGf = 25, asBC_NEGd = 26, asBC_INCi16 = 27, asBC_INCi8 = 28, asBC_DECi16 = 29, asBC_DECi8 = 30, asBC_INCi = 31, asBC_DECi = 32, asBC_INCf = 33, asBC_DECf = 34, asBC_INCd = 35, asBC_DECd = 36, asBC_IncVi = 37, asBC_DecVi = 38, asBC_BNOT = 39, asBC_BAND = 40, asBC_BOR = 41, asBC_BXOR = 42, asBC_BSLL = 43, asBC_BSRL = 44, asBC_BSRA = 45, asBC_COPY = 46, asBC_PshC8 = 47, asBC_RDS8 = 48, asBC_SWAP8 = 49, asBC_CMPd = 50, asBC_CMPu = 51, asBC_CMPf = 52, asBC_CMPi = 53, asBC_CMPIi = 54, asBC_CMPIf = 55, asBC_CMPIu = 56, asBC_JMPP = 57, asBC_PopRPtr = 58, asBC_PshRPtr = 59, asBC_STR = 60, asBC_CALLSYS = 61, asBC_CALLBND = 62, asBC_SUSPEND = 63, asBC_ALLOC = 64, asBC_FREE = 65, asBC_LOADOBJ = 66, asBC_STOREOBJ = 67, asBC_GETOBJ = 68, asBC_REFCPY = 69, asBC_CHKREF = 70, asBC_GETOBJREF = 71, asBC_GETREF = 72, asBC_SWAP48 = 73, asBC_SWAP84 = 74, asBC_OBJTYPE = 75, asBC_TYPEID = 76, asBC_SetV4 = 77, asBC_SetV8 = 78, asBC_ADDSi = 79, asBC_CpyVtoV4 = 80, asBC_CpyVtoV8 = 81, asBC_CpyVtoR4 = 82, asBC_CpyVtoR8 = 83, asBC_CpyVtoG4 = 84, asBC_CpyRtoV4 = 85, asBC_CpyRtoV8 = 86, asBC_CpyGtoV4 = 87, asBC_WRTV1 = 88, asBC_WRTV2 = 89, asBC_WRTV4 = 90, asBC_WRTV8 = 91, asBC_RDR1 = 92, asBC_RDR2 = 93, asBC_RDR4 = 94, asBC_RDR8 = 95, asBC_LDG = 96, asBC_LDV = 97, asBC_PGA = 98, asBC_RDS4 = 99, asBC_VAR = 100, asBC_iTOf = 101, asBC_fTOi = 102, asBC_uTOf = 103, asBC_fTOu = 104, asBC_sbTOi = 105, asBC_swTOi = 106, asBC_ubTOi = 107, asBC_uwTOi = 108, asBC_dTOi = 109, asBC_dTOu = 110, asBC_dTOf = 111, asBC_iTOd = 112, asBC_uTOd = 113, asBC_fTOd = 114, asBC_ADDi = 115, asBC_SUBi = 116, asBC_MULi = 117, asBC_DIVi = 118, asBC_MODi = 119, asBC_ADDf = 120, asBC_SUBf = 121, asBC_MULf = 122, asBC_DIVf = 123, asBC_MODf = 124, asBC_ADDd = 125, asBC_SUBd = 126, asBC_MULd = 127, asBC_DIVd = 128, asBC_MODd = 129, asBC_ADDIi = 130, asBC_SUBIi = 131, asBC_MULIi = 132, asBC_ADDIf = 133, asBC_SUBIf = 134, asBC_MULIf = 135, asBC_SetG4 = 136, asBC_ChkRefS = 137, asBC_ChkNullV = 138, asBC_CALLINTF = 139, asBC_iTOb = 140, asBC_iTOw = 141, asBC_SetV1 = 142, asBC_SetV2 = 143, asBC_Cast = 144, asBC_i64TOi = 145, asBC_uTOi64 = 146, asBC_iTOi64 = 147, asBC_fTOi64 = 148, asBC_dTOi64 = 149, asBC_fTOu64 = 150, asBC_dTOu64 = 151, asBC_i64TOf = 152, asBC_u64TOf = 153, asBC_i64TOd = 154, asBC_u64TOd = 155, asBC_NEGi64 = 156, asBC_INCi64 = 157, asBC_DECi64 = 158, asBC_BNOT64 = 159, asBC_ADDi64 = 160, asBC_SUBi64 = 161, asBC_MULi64 = 162, asBC_DIVi64 = 163, asBC_MODi64 = 164, asBC_BAND64 = 165, asBC_BOR64 = 166, asBC_BXOR64 = 167, asBC_BSLL64 = 168, asBC_BSRL64 = 169, asBC_BSRA64 = 170, asBC_CMPi64 = 171, asBC_CMPu64 = 172, asBC_ChkNullS = 173, asBC_ClrHi = 174, asBC_JitEntry = 175 }
| The bytecode instructions used by the VM. More...
enum | asEBCType { , asBCTYPE_NO_ARG = 1, asBCTYPE_W_ARG = 2, asBCTYPE_wW_ARG = 3, asBCTYPE_DW_ARG = 4, asBCTYPE_rW_DW_ARG = 5, asBCTYPE_QW_ARG = 6, asBCTYPE_DW_DW_ARG = 7, asBCTYPE_wW_rW_rW_ARG = 8, asBCTYPE_wW_QW_ARG = 9, asBCTYPE_wW_rW_ARG = 10, asBCTYPE_rW_ARG = 11, asBCTYPE_wW_DW_ARG = 12, asBCTYPE_wW_rW_DW_ARG = 13, asBCTYPE_rW_rW_ARG = 14, asBCTYPE_W_rW_ARG = 15, asBCTYPE_wW_W_ARG = 16, asBCTYPE_W_DW_ARG = 17, asBCTYPE_QW_DW_ARG = 18 }
| Describes the structure of a bytecode instruction. More...
## Functions
AS_API asIScriptEngine * | asCreateScriptEngine (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 asIScriptContext * | asGetActiveContext ()
| 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.
## Variables
const int | asBCTypeSize [19]
| Lookup table for determining the size of each type of bytecode instruction.
const asSBCInfo | asBCInfo [256]
| Information on each bytecode instruction.

## Detailed Description

This header file describes the complete application programming interface for AngelScript.

## Define Documentation

#define ANGELSCRIPT_VERSION 21800

Version 2.18.0

## Typedef Documentation

typedef void(* asJITFunction)(asSVMRegisters *registers, asDWORD entryId)

Parameters:

  `[in]` | registers | A pointer to the virtual machine's registers.
  `[in]` | entryId | The value defined by the JIT compiler for the current entry point in the JIT function.

A JIT function receives a pointer to the virtual machine's registers when called and an argument telling it where in the script function to continue the execution. The JIT function must make sure to update the VM's registers according to the actions performed before returning control to the VM.

See also:
  JIT compilation

## Enumeration Type Documentation

enum asEBCInstr

See also:
  Byte code instructions

Enumerator:

  asBC_POP | Decrease the stack with the amount in the argument.
  asBC_PUSH | Increase the stack with the amount in the argument.
  asBC_PshC4 | Push the 32bit value in the argument onto the stack.
  asBC_PshV4 | Push the 32bit value from a variable onto the stack.
  asBC_PSF | Push the address of the stack frame onto the stack.
  asBC_SWAP4 | Swap the top two DWORDs on the stack.
  asBC_NOT | Perform a boolean not on the value in a variable.
  asBC_PshG4 | Push the 32bit value from a global variable onto the stack.
  asBC_LdGRdR4 | Perform the actions of asBC_LDG followed by asBC_RDR4.
  asBC_CALL | Jump to a script function, indexed by the argument.
  asBC_RET | Return to the instruction after the last executed call.
  asBC_JMP | Unconditional jump to a relative position in this function.
  asBC_JZ | If the value register is 0 jump to a relative position in this function.
  asBC_JNZ | If the value register is not 0 jump to a relative position in this function.
  asBC_JS | If the value register is less than 0 jump to a relative position in this function.
  asBC_JNS | If the value register is greater than or equal to 0 jump to a relative position in this function.
  asBC_JP | If the value register is greater than 0 jump to a relative position in this function.
  asBC_JNP | If the value register is less than or equal to 0 jump to a relative position in this function.
  asBC_TZ | If the value register is 0 set it to 1.
  asBC_TNZ | If the value register is not 0 set it to 1.
  asBC_TS | If the value register is less than 0 set it to 1.
  asBC_TNS | If the value register is greater than or equal to 0 set it to 1.
  asBC_TP | If the value register is greater than 0 set it to 1.
  asBC_TNP | If the value register is less than or equal to 0 set it to 1.
  asBC_NEGi | Negate the 32bit integer value in the variable.
  asBC_NEGf | Negate the float value in the variable.
  asBC_NEGd | Negate the double value in the variable.
  asBC_INCi16 | Increment the 16bit integer value that is stored at the address pointed to by the reference in the value register.
  asBC_INCi8 | Increment the 8bit integer value that is stored at the address pointed to by the reference in the value register.
  asBC_DECi16 | Decrement the 16bit integer value that is stored at the address pointed to by the reference in the value register.
  asBC_DECi8 | Increment the 8bit integer value that is stored at the address pointed to by the reference in the value register.
  asBC_INCi | Increment the 32bit integer value that is stored at the address pointed to by the reference in the value register.
  asBC_DECi | Decrement the 32bit integer value that is stored at the address pointed to by the reference in the value register.
  asBC_INCf | Increment the float value that is stored at the address pointed to by the reference in the value register.
  asBC_DECf | Decrement the float value that is stored at the address pointed to by the reference in the value register.
  asBC_INCd | Increment the double value that is stored at the address pointed to by the reference in the value register.
  asBC_DECd | Decrement the double value that is stored at the address pointed to by the reference in the value register.
  asBC_IncVi | Increment the 32bit integer value in the variable.
  asBC_DecVi | Decrement the 32bit integer value in the variable.
  asBC_BNOT | Perform a bitwise complement on the 32bit value in the variable.
  asBC_BAND | Perform a bitwise and of two 32bit values and store the result in a third variable.
  asBC_BOR | Perform a bitwise or of two 32bit values and store the result in a third variable.
  asBC_BXOR | Perform a bitwise exclusive or of two 32bit values and store the result in a third variable.
  asBC_BSLL | Perform a logical left shift of a 32bit value and store the result in a third variable.
  asBC_BSRL | Perform a logical right shift of a 32bit value and store the result in a third variable.
  asBC_BSRA | Perform a arithmetical right shift of a 32bit value and store the result in a third variable.
  asBC_COPY | Pop the destination and source addresses from the stack. Perform a bitwise copy of the referred object. Push the destination address on the stack.
  asBC_PshC8 | Push a 64bit value on the stack.
  asBC_RDS8 | Pop an address from the stack, then read a 64bit value from that address and push it on the stack.
  asBC_SWAP8 | Swap the top two QWORDs on the stack.
  asBC_CMPd | Compare two double variables and store the result in the value register.
  asBC_CMPu | Compare two unsigned 32bit integer variables and store the result in the value register.
  asBC_CMPf | Compare two float variables and store the result in the value register.
  asBC_CMPi | Compare two 32bit integer variables and store the result in the value register.
  asBC_CMPIi | Compare 32bit integer variable with constant and store the result in value register.
  asBC_CMPIf | Compare float variable with constant and store the result in value register.
  asBC_CMPIu | Compare unsigned 32bit integer variable with constant and store the result in value register.
  asBC_JMPP | Jump to relative position in the function where the offset is stored in a variable.
  asBC_PopRPtr | Pop a pointer from the stack and store it in the value register.
  asBC_PshRPtr | Push a pointer from the value register onto the stack.
  asBC_STR | Push string address and length on the stack.
  asBC_CALLSYS | Call registered function. Suspend further execution if requested.
  asBC_CALLBND | Jump to an imported script function, indexed by the argument.
  asBC_SUSPEND | Call line callback function if set. Suspend execution if requested.
  asBC_ALLOC | Allocate the memory for the object. If the type is a script object then jump to the constructor, else call the registered constructor behaviour. Suspend further execution if requested.
  asBC_FREE | Pop the address of the object variable from the stack. If ref type, call the release method, else call the destructor then free the memory. Clear the pointer in the variable.
  asBC_LOADOBJ | Copy the object pointer from a variable to the object register. Clear the variable.
  asBC_STOREOBJ | Copy the object pointer from the object register to the variable. Clear the object register.
  asBC_GETOBJ | Move object pointer from variable onto stack location.
  asBC_REFCPY | Pop destination handle reference. Perform a handle assignment, while updating the reference count for both previous and new objects.
  asBC_CHKREF | Throw an exception if the pointer on the top of the stack is null.
  asBC_GETOBJREF | Replace a variable index on the stack with the object handle stored in that variable.
  asBC_GETREF | Replace a variable index on the stack with the address of the variable.
  asBC_SWAP48 | Swap the top DWORD with the QWORD below it.
  asBC_SWAP84 | Swap the top QWORD with the DWORD below it.
  asBC_OBJTYPE | Push the pointer argument onto the stack. The pointer is a pointer to an object type structure.
  asBC_TYPEID | Push the type id onto the stack. Equivalent to PshC4.
  asBC_SetV4 | Initialize the variable with a DWORD.
  asBC_SetV8 | Initialize the variable with a QWORD.
  asBC_ADDSi | Add a value to the top pointer on the stack, thus updating the address itself.
  asBC_CpyVtoV4 | Copy a DWORD from one variable to another.
  asBC_CpyVtoV8 | Copy a QWORD from one variable to another.
  asBC_CpyVtoR4 | Copy a DWORD from a variable into the value register.
  asBC_CpyVtoR8 | Copy a QWORD from a variable into the value register.
  asBC_CpyVtoG4 | Copy a DWORD from a local variable to a global variable.
  asBC_CpyRtoV4 | Copy a DWORD from the value register into a variable.
  asBC_CpyRtoV8 | Copy a QWORD from the value register into a variable.
  asBC_CpyGtoV4 | Copy a DWORD from a global variable to a local variable.
  asBC_WRTV1 | Copy a BYTE from a variable to the address held in the value register.
  asBC_WRTV2 | Copy a WORD from a variable to the address held in the value register.
  asBC_WRTV4 | Copy a DWORD from a variable to the address held in the value register.
  asBC_WRTV8 | Copy a QWORD from a variable to the address held in the value register.
  asBC_RDR1 | Copy a BYTE from address held in the value register to a variable. Clear the top bytes in the variable.
  asBC_RDR2 | Copy a WORD from address held in the value register to a variable. Clear the top word in the variable.
  asBC_RDR4 | Copy a DWORD from address held in the value register to a variable.
  asBC_RDR8 | Copy a QWORD from address held in the value register to a variable.
  asBC_LDG | Load the address of a global variable into the value register.
  asBC_LDV | Load the address of a local variable into the value register.
  asBC_PGA | Push the address of a global variable on the stack.
  asBC_RDS4 | Pop an address from the stack. Read a DWORD from the address, and push it on the stack.
  asBC_VAR | Push the index of the variable on the stack, with the size of a pointer.
  asBC_iTOf | Convert the 32bit integer value to a float in the variable.
  asBC_fTOi | Convert the float value to a 32bit integer in the variable.
  asBC_uTOf | Convert the unsigned 32bit integer value to a float in the variable.
  asBC_fTOu | Convert the float value to an unsigned 32bit integer in the variable.
  asBC_sbTOi | Expand the low byte as a signed value to a full 32bit integer in the variable.
  asBC_swTOi | Expand the low word as a signed value to a full 32bit integer in the variable.
  asBC_ubTOi | Expand the low byte as an unsigned value to a full 32bit integer in the variable.
  asBC_uwTOi | Expand the low word as an unsigned value to a full 32bit integer in the variable.
  asBC_dTOi | Convert the double value in one variable to a 32bit integer in another variable.
  asBC_dTOu | Convert the double value in one variable to a 32bit unsigned integer in another variable.
  asBC_dTOf | Convert the double value in one variable to a float in another variable.
  asBC_iTOd | Convert the 32bit integer value in one variable to a double in another variable.
  asBC_uTOd | Convert the 32bit unsigned integer value in one variable to a double in another variable.
  asBC_fTOd | Convert the float value in one variable to a double in another variable.
  asBC_ADDi | Add the values of two 32bit integer variables and store in a third variable.
  asBC_SUBi | Subtract the values of two 32bit integer variables and store in a third variable.
  asBC_MULi | Multiply the values of two 32bit integer variables and store in a third variable.
  asBC_DIVi | Divide the values of two 32bit integer variables and store in a third variable.
  asBC_MODi | Calculate the modulo of values of two 32bit integer variables and store in a third variable.
  asBC_ADDf | Add the values of two float variables and store in a third variable.
  asBC_SUBf | Subtract the values of two float variables and store in a third variable.
  asBC_MULf | Multiply the values of two float variables and store in a third variable.
  asBC_DIVf | Divide the values of two float variables and store in a third variable.
  asBC_MODf | Calculate the modulo of values of two float variables and store in a third variable.
  asBC_ADDd | Add the values of two double variables and store in a third variable.
  asBC_SUBd | Subtract the values of two double variables and store in a third variable.
  asBC_MULd | Multiply the values of two double variables and store in a third variable.
  asBC_DIVd | Divide the values of two double variables and store in a third variable.
  asBC_MODd | Calculate the modulo of values of two double variables and store in a third variable.
  asBC_ADDIi | Add a 32bit integer variable with a constant value and store the result in another variable.
  asBC_SUBIi | Subtract a 32bit integer variable with a constant value and store the result in another variable.
  asBC_MULIi | Multiply a 32bit integer variable with a constant value and store the result in another variable.
  asBC_ADDIf | Add a float variable with a constant value and store the result in another variable.
  asBC_SUBIf | Subtract a float variable with a constant value and store the result in another variable.
  asBC_MULIf | Multiply a float variable with a constant value and store the result in another variable.
  asBC_SetG4 | Set the value of global variable to a 32bit word.
  asBC_ChkRefS | Throw an exception if the address stored on the stack points to a null pointer.
  asBC_ChkNullV | Throw an exception if the variable is null.
  asBC_CALLINTF | Jump to an interface method, indexed by the argument.
  asBC_iTOb | Convert a 32bit integer in a variable to a byte, clearing the top bytes.
  asBC_iTOw | Convert a 32bit integer in a variable to a word, clearing the top word.
  asBC_SetV1 | Same as SetV4.
  asBC_SetV2 | Same as SetV4.
  asBC_Cast | Pop an object handle to a script class from the stack. Perform a dynamic cast on it and store the result in the object register.
  asBC_i64TOi | Convert the 64bit integer value in one variable to a 32bit integer in another variable.
  asBC_uTOi64 | Convert the 32bit unsigned integer value in one variable to a 64bit integer in another variable.
  asBC_iTOi64 | Convert the 32bit integer value in one variable to a 64bit integer in another variable.
  asBC_fTOi64 | Convert the float value in one variable to a 64bit integer in another variable.
  asBC_dTOi64 | Convert the double value in the variable to a 64bit integer.
  asBC_fTOu64 | Convert the float value in one variable to a 64bit unsigned integer in another variable.
  asBC_dTOu64 | Convert the double value in the variable to a 64bit unsigned integer.
  asBC_i64TOf | Convert the 64bit integer value in one variable to a float in another variable.
  asBC_u64TOf | Convert the 64bit unsigned integer value in one variable to a float in another variable.
  asBC_i64TOd | Convert the 32bit integer value in the variable to a double.
  asBC_u64TOd | Convert the 32bit unsigned integer value in the variable to a double.
  asBC_NEGi64 | Negate the 64bit integer value in the variable.
  asBC_INCi64 | Increment the 64bit integer value that is stored at the address pointed to by the reference in the value register.
  asBC_DECi64 | Decrement the 64bit integer value that is stored at the address pointed to by the reference in the value register.
  asBC_BNOT64 | Perform a bitwise complement on the 64bit value in the variable.
  asBC_ADDi64 | Perform an addition with two 64bit integer variables and store the result in a third variable.
  asBC_SUBi64 | Perform a subtraction with two 64bit integer variables and store the result in a third variable.
  asBC_MULi64 | Perform a multiplication with two 64bit integer variables and store the result in a third variable.
  asBC_DIVi64 | Perform a division with two 64bit integer variables and store the result in a third variable.
  asBC_MODi64 | Perform the modulo operation with two 64bit integer variables and store the result in a third variable.
  asBC_BAND64 | Perform a bitwise and of two 64bit values and store the result in a third variable.
  asBC_BOR64 | Perform a bitwise or of two 64bit values and store the result in a third variable.
  asBC_BXOR64 | Perform a bitwise exclusive or of two 64bit values and store the result in a third variable.
  asBC_BSLL64 | Perform a logical left shift of a 64bit value and store the result in a third variable.
  asBC_BSRL64 | Perform a logical right shift of a 64bit value and store the result in a third variable.
  asBC_BSRA64 | Perform a arithmetical right shift of a 64bit value and store the result in a third variable.
  asBC_CMPi64 | Compare two 64bit integer variables and store the result in the value register.
  asBC_CMPu64 | Compare two unsigned 64bit integer variables and store the result in the value register.
  asBC_ChkNullS | Check if a pointer on the stack is null, and if it is throw an exception. The argument is relative to the top of the stack.
  asBC_ClrHi | Clear the upper bytes of the value register so that only the value in the lowest byte is kept.
  asBC_JitEntry | If a JIT function is available and the argument is not 0 then call the JIT function.

enum asEBCType

Enumerator:

  asBCTYPE_NO_ARG | Instruction + no args.
  asBCTYPE_W_ARG | Instruction + WORD arg.
  asBCTYPE_wW_ARG | Instruction + WORD arg (dest var).
  asBCTYPE_DW_ARG | Instruction + DWORD arg.
  asBCTYPE_rW_DW_ARG | Instruction + WORD arg (source var) + DWORD arg.
  asBCTYPE_QW_ARG | Instruction + QWORD arg.
  asBCTYPE_DW_DW_ARG | Instruction + DWORD arg + DWORD arg.
  asBCTYPE_wW_rW_rW_ARG | Instruction + WORD arg (dest var) + WORD arg (source var) + WORD arg (source var).
  asBCTYPE_wW_QW_ARG | Instruction + WORD arg (dest var) + QWORD arg.
  asBCTYPE_wW_rW_ARG | Instruction + WORD arg (dest var) + WORD arg (source var).
  asBCTYPE_rW_ARG | Instruction + WORD arg (source var).
  asBCTYPE_wW_DW_ARG | Instruction + WORD arg (dest var) + DWORD arg.
  asBCTYPE_wW_rW_DW_ARG | Instruction + WORD arg (dest var) + WORD arg (source var) + DWORD arg.
  asBCTYPE_rW_rW_ARG | Instruction + WORD arg (source var) + WORD arg (source var).
  asBCTYPE_W_rW_ARG | Instruction + WORD arg + WORD arg (source var).
  asBCTYPE_wW_W_ARG | Instruction + WORD arg (dest var) + WORD arg.
  asBCTYPE_W_DW_ARG | Instruction + WORD arg + DWORD arg.
  asBCTYPE_QW_DW_ARG | Instruction + QWORD arg + DWORD arg.

enum asEBehaviours

Enumerator:

  asBEHAVE_CONSTRUCT | Constructor.
  asBEHAVE_DESTRUCT | Destructor.
  asBEHAVE_FACTORY | Factory.
  asBEHAVE_ADDREF | AddRef.
  asBEHAVE_RELEASE | Release.
  asBEHAVE_VALUE_CAST | Explicit value cast operator.
  asBEHAVE_IMPLICIT_VALUE_CAST | Implicit value cast operator.
  asBEHAVE_REF_CAST | Explicit reference cast operator.
  asBEHAVE_IMPLICIT_REF_CAST | Implicit reference cast operator.
  asBEHAVE_INDEX | operator []
  asBEHAVE_TEMPLATE_CALLBACK | Callback for validating template instances.
  asBEHAVE_GETREFCOUNT | (GC) Get reference count
  asBEHAVE_SETGCFLAG | (GC) Set GC flag
  asBEHAVE_GETGCFLAG | (GC) Get GC flag
  asBEHAVE_ENUMREFS | (GC) Enumerate held references
  asBEHAVE_RELEASEREFS | (GC) Release all references

enum asECallConvTypes

Enumerator:

  asCALL_CDECL | A cdecl function.
  asCALL_STDCALL | A stdcall function.
  asCALL_THISCALL | A thiscall class method.
  asCALL_CDECL_OBJLAST | A cdecl function that takes the object pointer as the last parameter.
  asCALL_CDECL_OBJFIRST | A cdecl function that takes the object pointer as the first parameter.
  asCALL_GENERIC | A function using the generic calling convention.

enum asECompileFlags

Enumerator:

  asCOMP_ADD_TO_MODULE | The compiled function should be added to the scope of the module.

enum asEContextState

Enumerator:

  asEXECUTION_FINISHED | The context has successfully completed the execution.
  asEXECUTION_SUSPENDED | The execution is suspended and can be resumed.
  asEXECUTION_ABORTED | The execution was aborted by the application.
  asEXECUTION_EXCEPTION | The execution was terminated by an unhandled script exception.
  asEXECUTION_PREPARED | The context has been prepared for a new execution.
  asEXECUTION_UNINITIALIZED | The context is not initialized.
  asEXECUTION_ACTIVE | The context is currently executing a function call.
  asEXECUTION_ERROR | The context has encountered an error and must be reinitialized.

enum asEEngineProp

Enumerator:

  asEP_ALLOW_UNSAFE_REFERENCES | Allow unsafe references. Default: false.
  asEP_OPTIMIZE_BYTECODE | Optimize byte code. Default: true.
  asEP_COPY_SCRIPT_SECTIONS | Copy script section memory. Default: true.
  asEP_MAX_STACK_SIZE | Maximum stack size for script contexts. Default: 0 (no limit).
  asEP_USE_CHARACTER_LITERALS | Interpret single quoted strings as character literals. Default: false.
  asEP_ALLOW_MULTILINE_STRINGS | Allow linebreaks in string constants. Default: false.
  asEP_ALLOW_IMPLICIT_HANDLE_TYPES | Allow script to declare implicit handle types. Default: false.
  asEP_BUILD_WITHOUT_LINE_CUES | Remove SUSPEND instructions between each statement. Default: false.
  asEP_INIT_GLOBAL_VARS_AFTER_BUILD | Initialize global variables after a build. Default: true.
  asEP_REQUIRE_ENUM_SCOPE | When set the enum values must be prefixed with the enum type. Default: false.
  asEP_SCRIPT_SCANNER | Select scanning method: 0 - ASCII, 1 - UTF8. Default: 1 (UTF8).
  asEP_INCLUDE_JIT_INSTRUCTIONS | When set extra bytecode instructions needed for JIT compiled funcions will be included. Default: false.
  asEP_STRING_ENCODING | Select string encoding for literals: 0 - UTF8/ASCII, 1 - UTF16. Default: 0 (UTF8).

enum asEExecStrFlags

Deprecated:
  since 2.18.0

Enumerator:

  asEXECSTRING_ONLY_PREPARE | Only prepare the context.
  asEXECSTRING_USE_MY_CONTEXT | Use the pre-allocated context.

enum asEGCFlags

Enumerator:

  asGC_FULL_CYCLE | Execute a full cycle.
  asGC_ONE_STEP | Execute only one step.
  asGC_DESTROY_GARBAGE | Destroy known garbage.
  asGC_DETECT_GARBAGE | Detect garbage with circular references.

enum asEGMFlags

Enumerator:

  asGM_ONLY_IF_EXISTS | Don't return any module if it is not found.
  asGM_CREATE_IF_NOT_EXISTS | Create the module if it doesn't exist.
  asGM_ALWAYS_CREATE | Always create a new module, discarding the existing one.

enum asEMsgType

Enumerator:

  asMSGTYPE_ERROR | The message is an error.
  asMSGTYPE_WARNING | The message is a warning.
  asMSGTYPE_INFORMATION | The message is informational only.

enum asEObjTypeFlags

Enumerator:

  asOBJ_REF | A reference type.
  asOBJ_VALUE | A value type.
  asOBJ_GC | A garbage collected type. Only valid for reference types.
  asOBJ_POD | A plain-old-data type. Only valid for value types.
  asOBJ_NOHANDLE | This reference type doesn't allow handles to be held. Only valid for reference types.
  asOBJ_SCOPED | The life time of objects of this type are controlled by the scope of the variable. Only valid for reference types.
  asOBJ_TEMPLATE | A template type.
  asOBJ_APP_CLASS | The C++ type is a class type. Only valid for value types.
  asOBJ_APP_CLASS_CONSTRUCTOR | The C++ class has an explicit constructor. Only valid for value types.
  asOBJ_APP_CLASS_DESTRUCTOR | The C++ class has an explicit destructor. Only valid for value types.
  asOBJ_APP_CLASS_ASSIGNMENT | The C++ class has an explicit assignment operator. Only valid for value types.
  asOBJ_APP_CLASS_C | The C++ type is a class with a constructor, but no destructor or assignment operator.
  asOBJ_APP_CLASS_CD | The C++ type is a class with a constructor and destructor, but no assignment operator.
  asOBJ_APP_CLASS_CA | The C++ type is a class with a constructor and assignment operator, but no destructor.
  asOBJ_APP_CLASS_CDA | The C++ type is a class with a constructor, destructor, and assignment operator.
  asOBJ_APP_CLASS_D | The C++ type is a class with a destructor, but no constructor or assignment operator.
  asOBJ_APP_CLASS_A | The C++ type is a class with an assignment operator, but no constructor or destructor.
  asOBJ_APP_CLASS_DA | The C++ type is a class with a destructor and assignment operator, but no constructor.
  asOBJ_APP_PRIMITIVE | The C++ type is a primitive type. Only valid for value types.
  asOBJ_APP_FLOAT | The C++ type is a float or double. Only valid for value types.
  asOBJ_SCRIPT_OBJECT | The object is a script class or an interface.

enum asERetCodes

Enumerator:

  asSUCCESS | Success.
  asERROR | Failure.
  asCONTEXT_ACTIVE | The context is active.
  asCONTEXT_NOT_FINISHED | The context is not finished.
  asCONTEXT_NOT_PREPARED | The context is not prepared.
  asINVALID_ARG | Invalid argument.
  asNO_FUNCTION | The function was not found.
  asNOT_SUPPORTED | Not supported.
  asINVALID_NAME | Invalid name.
  asNAME_TAKEN | The name is already taken.
  asINVALID_DECLARATION | Invalid declaration.
  asINVALID_OBJECT | Invalid object.
  asINVALID_TYPE | Invalid type.
  asALREADY_REGISTERED | Already registered.
  asMULTIPLE_FUNCTIONS | Multiple matching functions.
  asNO_MODULE | The module was not found.
  asNO_GLOBAL_VAR | The global variable was not found.
  asINVALID_CONFIGURATION | Invalid configuration.
  asINVALID_INTERFACE | Invalid interface.
  asCANT_BIND_ALL_FUNCTIONS | All imported functions couldn't be bound.
  asLOWER_ARRAY_DIMENSION_NOT_REGISTERED | The array sub type has not been registered yet.
  asWRONG_CONFIG_GROUP | Wrong configuration group.
  asCONFIG_GROUP_IS_IN_USE | The configuration group is in use.
  asILLEGAL_BEHAVIOUR_FOR_TYPE | Illegal behaviour for the type.
  asWRONG_CALLING_CONV | The specified calling convention doesn't match the function/method pointer.
  asBUILD_IN_PROGRESS | A build is currently in progress.
  asINIT_GLOBAL_VARS_FAILED | The initialization of global variables failed.

enum asETokenClass

Enumerator:

  asTC_UNKNOWN | Unknown token.
  asTC_KEYWORD | Keyword token.
  asTC_VALUE | Literal value token.
  asTC_IDENTIFIER | Identifier token.
  asTC_COMMENT | Comment token.
  asTC_WHITESPACE | White space token.

enum asETypeIdFlags

Enumerator:

  asTYPEID_VOID | The type id for void.
  asTYPEID_BOOL | The type id for bool.
  asTYPEID_INT8 | The type id for int8.
  asTYPEID_INT16 | The type id for int16.
  asTYPEID_INT32 | The type id for int.
  asTYPEID_INT64 | The type id for int64.
  asTYPEID_UINT8 | The type id for uint8.
  asTYPEID_UINT16 | The type id for uint16.
  asTYPEID_UINT32 | The type id for uint.
  asTYPEID_UINT64 | The type id for uint64.
  asTYPEID_FLOAT | The type id for float.
  asTYPEID_DOUBLE | The type id for double.
  asTYPEID_OBJHANDLE | The bit that shows if the type is a handle.
  asTYPEID_HANDLETOCONST | The bit that shows if the type is a handle to a const.
  asTYPEID_MASK_OBJECT | If any of these bits are set, then the type is an object.
  asTYPEID_APPOBJECT | The bit that shows if the type is an application registered type.
  asTYPEID_SCRIPTOBJECT | The bit that shows if the type is a script class.
  asTYPEID_SCRIPTARRAY | The bit that shows if the type is a script array.
  asTYPEID_MASK_SEQNBR | The mask for the type id sequence number.

enum asETypeModifiers

Enumerator:

  asTM_NONE | No modification.
  asTM_INREF | Input reference.
  asTM_OUTREF | Output reference.
  asTM_INOUTREF | In/out reference.

## 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.