Difference between revisions of "Object:type"

m
(10 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
Gets the type of the object as a string.
 
Gets the type of the object as a string.
 
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
Line 10: Line 9:
 
=== Returns ===
 
=== Returns ===
 
{{param|string|type|The type as a string.}}
 
{{param|string|type|The type as a string.}}
=== Examples ===
+
== Examples ==
 +
=== Printing the type of an object ===
 
<source lang="lua">
 
<source lang="lua">
 
image = love.graphics.newImage("test.png")
 
image = love.graphics.newImage("test.png")
Line 17: Line 17:
 
print(source:type()) -- outputs: Source
 
print(source:type()) -- outputs: Source
 
</source>
 
</source>
 +
 
== See Also ==
 
== See Also ==
 
* [[parent::Object]]
 
* [[parent::Object]]

Revision as of 15:19, 1 August 2015

Gets the type of the object as a string.

Function

Synopsis

type = Object:type()

Arguments

None.

Returns

string type
The type as a string.

Examples

Printing the type of an object

image = love.graphics.newImage("test.png")
print(image:type()) -- outputs: Image
source = love.audio.newSource("test.ogg")
print(source:type()) -- outputs: Source

See Also

Other Languages