Object:typeOf

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

See Also


doc_love
2017-03-21 15:51:25
Comments
Leave a Comment

Please login to continue.