Difference between revisions of "Object"
From GiderosMobile
Line 4: | Line 4: | ||
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | '''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | ||
'''<translate>Available since</translate>:''' Gideros 2015.08<br/> | '''<translate>Available since</translate>:''' Gideros 2015.08<br/> | ||
+ | |||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
− | + | Main Object class from which all Gideros classes inherit. | |
− | There is no other purpose for this | + | |
+ | There is no other purpose for this class, rather a neat way to add methods to all Gideros classes. | ||
+ | |||
=== <translate>Examples</translate> === | === <translate>Examples</translate> === | ||
− | + | <source lang="lua"> | |
− | <source lang="lua">local bmp = Bitmap.new("image.png") | + | local bmp = Bitmap.new("image.png") |
print(bmp:getClass()) -- prints Bitmap | print(bmp:getClass()) -- prints Bitmap | ||
print(bmp:getBaseClass()) -- prints Sprite | print(bmp:getBaseClass()) -- prints Sprite | ||
Line 16: | Line 19: | ||
print(bmp:isInstanceOf("EventDispatcher")) -- prints true | print(bmp:isInstanceOf("EventDispatcher")) -- prints true | ||
print(bmp:isInstanceOf("Object")) -- prints true | print(bmp:isInstanceOf("Object")) -- prints true | ||
− | print(bmp:isInstanceOf("TileMap")) -- prints false</source> | + | print(bmp:isInstanceOf("TileMap")) -- prints false |
+ | </source> | ||
+ | |||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
Line 23: | Line 28: | ||
[[Special:MyLanguage/Object:getClass|Object:getClass]] ''<translate>returns class name</translate>''<br/><!-- GIDEROSMTD:Object:getClass() returns class name --> | [[Special:MyLanguage/Object:getClass|Object:getClass]] ''<translate>returns class name</translate>''<br/><!-- GIDEROSMTD:Object:getClass() returns class name --> | ||
[[Special:MyLanguage/Object:isInstanceOf|Object:isInstanceOf]] ''<translate>checks if instance belongs to class</translate>''<br/><!-- GIDEROSMTD:Object:isInstanceOf(classname) checks if instance belongs to class --> | [[Special:MyLanguage/Object:isInstanceOf|Object:isInstanceOf]] ''<translate>checks if instance belongs to class</translate>''<br/><!-- GIDEROSMTD:Object:isInstanceOf(classname) checks if instance belongs to class --> | ||
+ | |||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== <translate>Events</translate> === | === <translate>Events</translate> === | ||
=== <translate>Constants</translate> === | === <translate>Constants</translate> === | ||
|} | |} | ||
− | |||
− |
Revision as of 23:45, 9 December 2019
Supported platforms:
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
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
MethodsObject:getBaseClass returns base class |
EventsConstants |