Difference between revisions of "Object:typeOf"

(Created page with '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 …')
 
m (added "Other Languages" section)
Line 28: Line 28:
 
{{#set:Description=Checks whether an object is of a certain type.}}
 
{{#set:Description=Checks whether an object is of a certain type.}}
 
[[Category:Functions]]
 
[[Category:Functions]]
 +
 +
== Other Languages ==
 +
{{i18n|Object:typeOf}}

Revision as of 15:06, 16 November 2010

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