index

Reference: asIScriptArray

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

  // Array type
  int GetArrayTypeId();

  // Elements
  int    GetElementTypeId();
  asUINT GetElementCount();
  void * GetElementPointer(asUINT index);
  void   Resize(asUINT size);
  int    CopyFrom(asIScriptArray *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.

GetArrayTypeId

int GetArrayTypeId();

Description

Returns the type id of the script array.

Returns

The type id.

GetElementTypeId

int GetElementTypeId();

Description

Use this method to determine the type of the elements and how to handle the pointer returned by GetElementPointer().

Returns

The type id of the elements.

GetElementCount

asUINT GetElementCount();

Description

Use this method to determine how many elements there are in the array.

Returns

The size of the array.

GetElementPointer

void *GetElementPointer(asUINT index);

Description

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

Parameters

index 

The zero based index of the element of interest.

Returns

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

Resize

void Resize(asUINT size);

Description

This method allows the application to resize the array.

Parameters

size 

The new size of the array.

CopyFrom

int CopyFrom(asIScriptArray *other);

Description

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

Parameters

other 

A pointer to the other array object.

Returns

A negative value on error.

top