Path: /sdk/add_on/scripthandle/
The ref
type is a generic container that can hold any handle. It is a value type, but behaves very much like an object handle.
The type is registered with RegisterScriptHandle(asIScriptEngine*)
.
Even though the CScriptHandle is a value type, when registering properties of its type they should be registered as handles. The same goes for function arguments and return types.
To set an object pointer in the handle from the application, you'll use the Set() method passing a pointer to the object and the type of the object.
To retrieve an object pointer from the application you'll use the Cast() method passing in a pointer to the pointer and the wanted type id. If the type id given doesn't match the stored handle the returned pointer will be null.
To retrieve an object of an unknown type use the GetType() or GetTypeId() to determine the type stored in the handle, then use the Cast() method.