Difference between revisions of "Object:type"

(Move example to example section)
(Not a documented or supported behavior)
Line 16: Line 16:
 
source = love.audio.newSource("test.ogg")
 
source = love.audio.newSource("test.ogg")
 
print(source:type()) -- outputs: Source
 
print(source:type()) -- outputs: Source
</source>
 
  
An alternate way of printing the type:
 
<source lang="lua">
 
type = tostring(Object)
 
</source>
 
 
== See Also ==
 
== See Also ==
 
* [[parent::Object]]
 
* [[parent::Object]]

Revision as of 17:18, 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 ==
* [[parent::Object]]
{{#set:Description=Gets the type of the object as a string.}}
{{#set:Since=000}}
[[Category:Functions]]
== Other Languages ==
{{i18n|Object:type}}