The array type is a template object that allow the scripts to declare arrays of any type. Since it is a generic class it is not the most performatic due to the need to determine characteristics at runtime. For that reason it is recommended that the application registers a template specialization for the array types that are most commonly used.
The type is registered with RegisterScriptArray(asIScriptEngine*).
class CScriptArray { public: // Constructor CScriptArray(asUINT length, asIObjectType *ot); virtual ~CScriptArray(); // Memory management void AddRef(); void Release(); // Type information asIObjectType *GetArrayObjectType() const; int GetArrayTypeId() const; int GetElementTypeId() const; // Get the current size asUINT GetSize(); // Resize the array void Resize(asUINT numElements); // Get a pointer to an element. Returns 0 if out of bounds void *At(asUINT index); // Copy the contents of one array to another (only if the types are the same) CScriptArray &operator=(const CScriptArray&); };
  class array<class T>
  {
    array();
    array(uint length);
    // Access elements
    // T & operator [] (uint)
    // const T & operator [] (uint) const
array<T> opAssign(const array<T> & in);
    uint length();
    void resize(uint);
  }
  int main()
  {
    array<int> arr(3);
    arr[0] = 1;
    arr[1] = 2;
    arr[2] = 3;
    int sum = 0;
    for( uint n = 0; n < arr.length(); n++ )
      sum += arr[n];
return sum; }
 1.5.9
 1.5.9