The any
type is a generic container that can hold any value. It is a reference type.
The type is registered with RegisterScriptAny(asIScriptEngine*);
.
In the scripts it can be used as follows:
int value; obj object; obj @handle; any a,b,c; a.store(value); // store the value b.store(@handle); // store an object handle c.store(object); // store a copy of the object
a.retrieve(value); // retrieve the value b.retrieve(@handle); // retrieve the object handle c.retrieve(object); // retrieve a copy of the object
In C++ the type can be used as follows:
CScriptAny *myAny; int typeId = engine->GetTypeIdByDecl(0, "string@"); asCScriptString *str = new asCScriptString("hello world"); myAny->Store((void*)&str, typeId); myAny->Retrieve((void*)&str, typeId);