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

Other Languages

Personal tools