|
AngelScript
|
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*).
In the scripts it can be used as follows:
ref@ unknown;
// Store a handle in the ref variable object obj; @unknown = @obj;
// Compare equalness
if( unknown != null )
{
// Dynamically cast the handle to wanted type
object @obj2 = cast<object>(unknown);
if( obj2 != null )
{
...
}
}
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.