BrightSign BrightScript 2 Reference Guide User Manual
Page 46
46
The roArray class implements the ifArray and ifEnum interfaces.
This object is created with two parameters:
CreateObject("roArray", size As Integer, resize As
Boolean)
o Size is the initial number of elements allocated for the array. If resize is true,
the array will be resized larger if needed to accommodate more elements. If
the array is large, this process might be slow.
o
The “dim” statement may be used instead of CreateObject to create a new
array. Dim has the advantage in that it automatically creates arrays of arrays
for multi-dimensional arrays.
The ifArray interface provides:
GetEntry(index As Integer) As Object
o Returns an Array entry of a given index. Entries start at zero. If an entry is
fetched that has not been set, “invalid” is returned.
SetEntry(index As Integer, value As Object) As Void
o Sets an entry of a given index
Peek() As Object
o Returns the last (highest index) array entry without removing it.
Pop() As Object
o Returns the last (highest index) array entry and removes it from the array.
Push(value As Object) As Object
o Adds a new highest index entry into an array (adds to the end of the array)
Shift() As Object
o Removes index zero from the array and shifts every other entry down one.
This is like a “pop” from the bottom of the array instead of the top.
Unshift(value As Object) As Integer
o Adds a new index zero to the array and shifts ever other index up one to
accomidate. This is like a Push to the bottom of the array.
Delete(index as Integer) As Boolean
o Deletes the indicated array entry, and shifts down all entries above to fill the
hole. The array length is decreased by one.
Count() As Integer
o Returns the index of highest entry in the array+1 (the length of the array).
Clear() As Void
o Deletes every entry in the array.
Append(As Object) As Void
o Appends one object to another. The two objects must be of the same type.
roByteArray
The byte array component is used to contain and manipulate an arbitrary array of bytes.
It contains functions to convert strings to or from a byte array, as well as to or from ascii