BrightSign BrightScript 2 Reference Guide User Manual
Page 45

45
CreateObject("roAssociativeArray")
The ifAssociativeArray interface provides:
AddReplace(key As String, value As Object) As Void
o Add a new entry to the array associating the supplied object with the supplied
string. Only one object may be associated with a string so any existing object
is discarded.
Lookup(key As String) As Object
o Look for an object in the array associated with the specified key. If there is no
object associated with the key then type “invalid” is returned.
DoesExist(key As String) As Boolean
o Look for an object in the array associated with the specified key. If there is no
associated object then false is returned. If there is such an object then true is
returned.
Delete(key As String) As Boolean
o Look for an object in the array associated with the specified key. If there is
such an object then it is deleted and true is returned. If not then false is
returned.
Clear() As Void
o Remove all objects from the associative array.
SetModeCaseSensitive() As void
o Associative Array lookups are case insensitive by default. This call makes all
subsequent actions case sensitive.
Example:
aa = CreateObject("roAssociativeArray")
aa.AddReplace("Bright", "Sign")
aa.AddReplace("TMOL", 42)
print aa.Lookup("TMOL")
print aa.Lookup("Bright")
Produces:
42
Sign
roArray
An array stores objects in a continuous array of memory location. Since an roArray
contains Roku Objects, and there are object wrappers for most intrinsic data types, each
entry of an array can be a different type (or all of the same type).