6.1-roArray


ON THIS PAGE

This object stores objects in a continuous array of memory locations. Since an roArray contains BrightScript components, and there are object wrappers for most intrinsic data types, entries can either be different types or all of the same type. 

Object Creation: The roArray object is created with two parameters. 

CreateObject("roArray", size As Integer, resize As Boolean)
  • size: The initial number of elements allocated for an array.
  • resize: If true, the array will be resized larger to accommodate more elements if needed. If the array is large, this process might take some time.


The DIM statement may be used instead of the CreateObject() function to create a new array. The DIM statement can be advantageous because it automatically creates array-of-array structures for multi-dimensional arrays. 

ifArray

Peek() As Dynamic

Returns the last (highest index) array entry without removing it.

Pop() As Dynamic

Returns the last (highest index) entry and removes it from the array.

Push(a As Dynamic)

Adds a new highest index entry to the end of the array.

Shift() As Dynamic

Removes index zero from the array and shifts all other entries down by one unit.

Unshift(a As Dynamic)

Adds a new index zero to the array and shifts all other entries up by one unit.

Delete(a As Integer) As Boolean

Deletes the indicated array entry and shifts all above entries down by one unit.

Count() As Integer

Returns the index of the highest entry in the array plus one (i.e. the length of the array).

Clear()

Deletes every entry in the array.

Append(a As Object)

Appends one roArray to another. If the passed roArray contains entries that were never set to a value, they are not appended.

Note

The two appended objects must be of the same type. 

ifEnum

Reset()

Resets the position to the first element of enumeration.

Next() As Dynamic

Returns a typed value at the current position and increment position.

IsNext() As Boolean

Returns True if there is a next element.

IsEmpty() As Boolean

Returns True if there is not an exact statement.

ifArrayGet

GetEntry(a As Integer) As Dynamic

Returns an array entry of a given index. Entries start at zero. If an entry that has not been set is fetched, Invalid is returned.

ifArraySet

SetEntry(a As Integer, b As Dynamic)

Sets an entry of a given index to the passed type value.
Â