Object

From GiderosMobile
Revision as of 15:30, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2015.08

Description

Main Object class from which all Gideros classes inherit.

There is no other purpose for this class, rather a neat way to add methods to all Gideros classes.

Examples

<syntaxhighlight lang="lua"> local bmp = Bitmap.new("image.png") print(bmp:getClass()) -- prints Bitmap print(bmp:getBaseClass()) -- prints Sprite print(bmp:isInstanceOf("Bitmap")) -- prints true print(bmp:isInstanceOf("Sprite")) -- prints true print(bmp:isInstanceOf("EventDispatcher")) -- prints true print(bmp:isInstanceOf("Object")) -- prints true print(bmp:isInstanceOf("TileMap")) -- prints false </source>

Methods

Object:getBaseClass returns base class
Object:getClass returns class name
Object:isInstanceOf checks if instance belongs to class

Events

Constants