Brightscript core objects, Roarray – BrightSign Object Reference Manual (FW 5.1) User Manual

Page 14

Advertising
background image

6

BRIGHTSCRIPT CORE OBJECTS

roArray

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 is

sometimes advantageous because it automatically creates array-of-array structures for multi-dimensional arrays.

Interfaces:

ifArray

,

ifEnum

,

ifArrayGet

,

ifArraySet


The ifArray interface provides the following:

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.

Advertising