Skip to end of metadata
Go to start of metadata

Object equivalent for intrinsic type Integer.

Supported Interfaces

Description

This is useful in the following situations:

  • When an object is needed, instead of an intrinsic value. For example, "roList" maintains a list of objects. If an Integer is added to roList, it will be automatically wrapped in an roInt by the language interpreter. When a function that expects a BrightScript Component as a parameter is passed an int, BrightScript automatically creates the equivalent BrightScript Component.
  • If any object exposes the ifInt interface, 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.

 

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
  • No labels