index

Reference: asIScriptStruct

class asIScriptStruct
{
public:
  // Memory management
  int AddRef();
  int Release();

  // Struct type
  int GetStructTypeId();

  // Struct properties
  int GetPropertyCount();
  int GetPropertyTypeId(asUINT prop);
  const char *GetPropertyName(asUINT prop);
  void *GetPropertyPointer(asUINT prop);
  int CopyFrom(asIScriptStruct *other);
};

AddRef

int AddRef();

Description

This method increases the internal reference counter of the object and returns the count. The returned value shouldn't be used for anything else but debugging.

Call AddRef() each time you assign a reference to a new variable.

Returns

The internal reference counter.

Release

int Release();

Description

Decreases the internal reference counter and returns the count. If the counter reaches 0 the object is deleted and the memory is freed.

After calling Release() don't forget to set your reference to 0 so that you don't mistakenly try to use the reference again.

Returns

The internal reference counter.

GetStructTypeId

int GetStructTypeId();

Description

Returns the type id of the script structure.

Returns

The type id.

GetPropertyCount

int GetPropertyCount();

Description

Use this method to determine how many properties this structure has.

Returns

The number of properties.

GetPropertyTypeId

int GetPropertyTypeId(asUINT prop);

Description

Use the returned type id, to determine how to handle the property pointer.

Parameters

prop 

The zero based index of the property of interest.

Returns

If the index is within range, then the method returns the type id of the property, otherwise the value will be negative.

GetPropertyName

const char *GetPropertyName(asUINT prop);

Description

The method returns a string with the name of the property as declared in the script.

Parameters

prop 

The zero based index of the property of interest.

Returns

A pointer to the string, or null if out of range.

GetPropertyPointer

void *GetPropertyPointer(asUINT prop);

Description

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.

Parameters

prop 

The zero based index of the property of interest.

Returns

A pointer to the property.

CopyFrom

int CopyFrom(asIScriptStruct *other);

Description

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

Parameters

other 

A pointer to the other struct object.

Returns

A negative value on error.

top