BrightSign BrightScript 2 Reference Guide User Manual
Page 44
![background image](https://www.manualsdir.com/files/776464/content/doc044.png)
44
automatically wrapped in an roInt by the language interpreter. When a function
that expects a Roku Object as a parameter is passed an int, float, function, or
string, BrightScript automatically creates the equivalent Roku object.
If any object exposes the ifInt, ifFloat, ifBoolean or ifString interfaces, that object
can be used in any expression that expects an intrinsic value. For example, in this
way an roTouchEvent can be used as an integer whose value is the userid of the
roTouchEvent.
Notes:
If o is an roInt, then the following statements have the following effects
1. print o „ prints o.GetInt()
2. i%=o „ assigns the integer i% the value of o.GetInt()
3. k=o „presumably k is dynamic typed, so it becomes another reference
to the roInt o
4. o=5
„this is NOT the same as o.SetInt(5). Instead it releases o, and
„changes the type of o to Integer (o is dynamically typed). And
assigns it to 5.
Example:
BrightScript> o=CreateObject("roInt")
BrightScript> o.SetInt(555)
BrightScript> print o
555
BrightScript> print o.GetInt()
555
BrightScript> print o-55
500
Example:
BrightScript> list=CreateObject("roList")
BrightScript> list.AddTail(5)
BrightScript> print type(list.GetTail())
roInt
Note that an integer value of "5" is converted to type "roInt" automatically,
because list.AddTail() expects an Roku Object as its parameter.
roAssociativeArray
An associative array (also knows as a map, dictionary or hash table) allows objects to be
associated with string keys. The roAssociativeArray class implements the
ifAssociativeArray and ifEnum interfaces.
This object is created with no parameters: