Path: /sdk/add_on/scriptany/
The any
type is a generic container that can hold any value. It is a reference type.
The type is registered with RegisterScriptAny(asIScriptEngine*)
.
class any { any(); any(? &in value); any(int64 &in value); any(double &in value); any &opAssign(const any &in other); void store(? &in value); void store(int64 &in value); void store(double &in value); bool retrieve(? &out value) const; bool retrieve(int64 &out value) const; bool retrieve(double &out value) const; }
any()
any(? &in value)
any(int64 &in value)
any(double &in value)
The default constructor creates an empty object, and the second initializes the object with the provided value.
The int64 and double overloads make sure that all numbers are converted to 64bit before being stored in the object.
any &opAssign(const any &in other)
The assignment operator will copy the contained value from the other object.
void store(? &in value)
void store(int64 &in value)
void store(double &in value)
These methods sets the value in the object.
The int64 and double overloads make sure that all numbers are converted to 64bit before being stored in the object.
bool retrieve(? &out value) const
bool retrieve(int64 &out value) const
bool retrieve(double &out value) const
These methods retrieve the value stored in the object. The methods will return true if the stored value is compatible with the requested type.
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: