
23
roInt, roFloat, roString
The intrinsic types roInt32, roFloat, and roString have an object and interface equivalent. These are useful in the following
situations:
• An object is needed instead of a typed value. For example, roList maintains a list of objects.
• If any object exposes the ifInt, ifFloat, or ifString interfaces, that object can be used in any expression that expects
a typed value. For example, an roTouchEvent can be used as an integer whose value is the userid of the
roTouchEvent.
Note: If "o" is an roInt, then these statements have the following effects:
o print o: Prints o.GetInt()
o i%=o: Assigns the integer i% the value of o.GetInt()
o k=o: Presumably k is typeOmatic, so it becomes another reference to the roInt o
o o=5: This is NOT the same as o.SetInt(5). Instead it releases o, changes the type of o to roINT32 (o is
typeOmatic), and assigns it to 5.
When a function that expects a BrightScript Object as a parameter is passed an int, float, or string, BrightScript
automatically creates the equivalent object.
Interfaces: ifInt, ifIntOps, ifFloat, ifString, ifStringOps
roInt contains the ifInt interface, which provides the following:
• GetInt() As Integer
• SetInt(value As Integer) As Void
Kommentare zu diesen Handbüchern