Difference between revisions of "Shape:getType"

 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
 
Gets a string representing the Shape.
 
Gets a string representing the Shape.
 
This function can be useful for conditional debug drawing.
 
This function can be useful for conditional debug drawing.
Line 11: Line 10:
 
=== Returns ===
 
=== Returns ===
 
{{param|ShapeType|type|The type of the Shape.}}
 
{{param|ShapeType|type|The type of the Shape.}}
 +
== Examples ==
 +
 +
=== Printing the type of a shape ===
 +
<source lang="lua">
 +
 +
shape1 = love.physics.newCircleShape( my_body, 0, 0, 20 )
 +
print(shape1:getType()) -- outputs: 'circle'
 +
 +
shape2 = love.physics.newPolygonShape( my_body, ... )
 +
print(shape2:getType()) -- outputs: 'polygon'
 +
 +
shape3 = love.physics.newRectangleShape( my_body, x, y, w, h, angle )
 +
print(shape3:getType()) -- outputs: 'polygon'
 +
 +
</source>
 
== See Also ==
 
== See Also ==
 
* [[parent::Shape]]
 
* [[parent::Shape]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Gets a string representing the Shape.
+
{{#set:Description=Gets a string representing the Shape.}}
}}
+
{{#set:Since=000}}
 +
== Other Languages ==
 +
{{i18n|Shape:getType}}

Latest revision as of 10:53, 25 March 2011

Gets a string representing the Shape. This function can be useful for conditional debug drawing.

Function

Synopsis

type = Shape:getType( )

Arguments

None.

Returns

ShapeType type
The type of the Shape.

Examples

Printing the type of a shape

shape1 = love.physics.newCircleShape( my_body, 0, 0, 20 )
print(shape1:getType()) -- outputs: 'circle'

shape2 = love.physics.newPolygonShape( my_body, ... )
print(shape2:getType()) -- outputs: 'polygon'

shape3 = love.physics.newRectangleShape( my_body, x, y, w, h, angle )
print(shape3:getType()) -- outputs: 'polygon'

See Also


Other Languages