Views
Object:typeOf
Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.
Function
Synopsis
b = Object:typeOf( name )
Arguments
string name
- The name of the type to check for.
Returns
boolean b
- True if the object is of the specified type, false otherwise.
Examples
Checking the type of an object
image = love.graphics.newImage("test.png")
print(image:typeOf("Object")) -- outputs: true
print(image:typeOf("Drawable")) -- outputs: true
print(image:typeOf("Image")) -- outputs: true
print(image:typeOf("MouseJoint")) -- outputs: false
print(image:typeOf("Object")) -- outputs: true
print(image:typeOf("Drawable")) -- outputs: true
print(image:typeOf("Image")) -- outputs: true
print(image:typeOf("MouseJoint")) -- outputs: false
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info