Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
In general, this manual uses the term “object” to refer to “BrightScript components”, which are C or C++ components with interfaces and member functions that BrightScript uses directly. With the exception of some core objects (roArray, roAssociativeArray, roInt, roMessagePort, etc.), BrightScript objects are platform specific.
You can create intrinsic objects in BrightScript, but these objects are not BrightScript components. There is currently no way to create a BrightScript component in BrightScript or to create intrinsic objects that have interfaces (intrinsic objects can only contain member functions, properties, and other objects).
A BrightScript object is simply an roAssociativeArray: When a member function is called from an associative array, a “this” pointer is set to “m”, and “m” is accessible inside the Function code to access object keys. A “constructor” in BrightScript is simply a normal function at a global scope that creates an roAssociativeArray instance and fills in its member functions and properties
See the “snake” game in the appendix for examples of creating intrinsic objects.