| AngelScript |

Loading...
Searching...
No Matches
List of all members
asIScriptObject Class Referenceabstract
Secondary interfaces

The interface for an instance of a script object.

## Public Member Functions
Memory management
virtual int | AddRef () const =0
| Increase reference counter.
virtual int | Release () const =0
| Decrease reference counter.
virtual asILockableSharedBool * | GetWeakRefFlag () const =0
| Returns the weak ref flag for the object.
Type info
virtual int | GetTypeId () const =0
| Returns the type id of the object.
virtual asITypeInfo * | GetObjectType () const =0
| Returns the object type interface for the object.
Properties
virtual asUINT | GetPropertyCount () const =0
| Returns the number of properties that the object contains.
virtual int | GetPropertyTypeId (asUINT prop) const =0
| Returns the type id of the property referenced by prop.
virtual const char * | GetPropertyName (asUINT prop) const =0
| Returns the name of the property referenced by prop.
virtual void * | GetAddressOfProperty (asUINT prop)=0
| Returns a pointer to the property referenced by prop.
Miscellaneous
virtual asIScriptEngine * | GetEngine () const =0
| Return the script engine.
virtual int | CopyFrom (const asIScriptObject *other)=0
| Copies the content from another object of the same type.
User data
virtual void * | SetUserData (void *data, asPWORD type=0)=0
| Sets user data on the script object instance.
virtual void * | GetUserData (asPWORD type=0) const =0
| Gets user data from the script object instance.

## Member Function Documentation

## ◆ AddRef()

virtual int asIScriptObject::AddRef | ( |  | ) | const
| pure virtual

Returns
  The number of references to this object.

Call this method when storing an additional reference to the object.

## ◆ CopyFrom()

virtual int asIScriptObject::CopyFrom | ( | const asIScriptObject * | other | ) |
| pure virtual

Parameters

  [in] | other | A pointer to the source object.

Returns
  A negative value on error.

Return values

  asINVALID_ARG | The argument is null.
  asINVALID_TYPE | The other object is of different type.

This method copies the contents of the other object to this one.

## ◆ GetAddressOfProperty()

virtual void * asIScriptObject::GetAddressOfProperty | ( | asUINT | prop | ) |
| pure virtual

Parameters

  [in] | prop | The property index.

Returns
  A pointer to the property value.

The method returns a pointer to the memory location for the property. Use the type id for the property to determine the content of the pointer, and how to handle it.

## ◆ GetEngine()

virtual asIScriptEngine * asIScriptObject::GetEngine | ( |  | ) | const
| pure virtual

Returns
  The script engine.

## ◆ GetObjectType()

virtual asITypeInfo * asIScriptObject::GetObjectType | ( |  | ) | const
| pure virtual

Returns
  The object type interface of the script object.

This does not increase the reference count of the returned object type.

## ◆ GetPropertyCount()

virtual asUINT asIScriptObject::GetPropertyCount | ( |  | ) | const
| pure virtual

Returns
  The number of member properties of the script object.

## ◆ GetPropertyName()

virtual const char * asIScriptObject::GetPropertyName | ( | asUINT | prop | ) | const
| pure virtual

Parameters

  [in] | prop | The property index.

Returns
  A null terminated string with the property name.

## ◆ GetPropertyTypeId()

virtual int asIScriptObject::GetPropertyTypeId | ( | asUINT | prop | ) | const
| pure virtual

Parameters

  [in] | prop | The property index.

Returns
  The type id of the member property, or a negative value on error.

Return values

  asINVALID_ARG | prop is too large

## ◆ GetTypeId()

virtual int asIScriptObject::GetTypeId | ( |  | ) | const
| pure virtual

Returns
  The type id of the script object.

## ◆ GetUserData()

virtual void * asIScriptObject::GetUserData | ( | asPWORD | type = `0` | ) | const
| pure virtual

Parameters

  [in] | type | An identifier used to identify which user data to get.

Returns
  The pointer to the user data.

## ◆ GetWeakRefFlag()

virtual asILockableSharedBool * asIScriptObject::GetWeakRefFlag | ( |  | ) | const
| pure virtual

Returns
  The weak ref flag for the object.

This is a short-cut for the asIScriptEngine::GetWeakRefFlagOfScriptObject method.

## ◆ Release()

virtual int asIScriptObject::Release | ( |  | ) | const
| pure virtual

Returns
  The number of references to this object.

Call this method when you will no longer use the references that you own.

## ◆ SetUserData()

virtual void * asIScriptObject::SetUserData | ( | void * | data,
|  | asPWORD | type = `0`
| ) |  |
| pure virtual

Parameters

  [in] | data | A pointer to the user data.
  [in] | type | An identifier used to identify which user data to set.

Returns
  The previous pointer stored in the object type.

This method allows the application to associate a value, e.g. a pointer, with the script object instance. Multiple different values can be defined where the type argument identifies which is referred to.

The user data types identifiers between 1000 and 1999 are reserved for use by official add-ons.

Optionally, a callback function can be registered to clean up the user data when the script object is destroyed.

The documentation for this class was generated from the following file:

- angelscript.h