Array and function-call operators – BrightSign BrightScript 3.0 Reference Manual User Manual
Page 17

12
Associative Arrays
When the "
." Dot Operator is used on an Associative Array, it is the same as calling the Lookup() or AddReplace()
methods, which are member functions of the roAssociativeArray object:
aa=CreateObject("roAssociativeArray")
aa.newkey="the value"
print aa.newkey
Note that the parameters of the Dot Operator are set at compile time; they are not dynamic, unlike the
Lookup() and
AddReplace() methods.
The Dot Operator is always case insensitive: For example, the following statement will create the entry "newkey" in the
associative array:
aa.NewKey=55
Array and Function-Call Operators
The
[] operator is used to access an array (i.e. any BrightScript object that has an ifArray interface, such as roArray and
roList objects). It can also be used to access an associative array. The
[] operator takes expressions that are evaluated
at runtime, while the "
." Dot Operator takes identifiers at compile time.
The
() operator can be used to call a function. When used on a function literal (or variable containing a function
reference), that function will be called.
Example: This code snippet demstrates the use of both array and function-call operators.
aa=CreateObject("roAssociativeArray")
aa["newkey"]="the value"
print aa["newkey"]