Page 1 of 1

Trouble with PolygonShape:GetPoints

Posted: Fri Apr 23, 2010 5:43 am
by jbm222
So I'm having trouble with PolygonShape:getPoints(). I'm trying to call the function like so:

Code: Select all

love.graphics.polygon("fill", myShape:getPoints())
The error I see is "Incorrect Parameter Type : Expected User Data"

Any suggestions? I should mention that even though I've been programming for several years, I am new to lua and love2d.

Re: Trouble with PolygonShape:GetPoints

Posted: Fri Apr 23, 2010 6:07 am
by nevon
I think you need to do:

Code: Select all

love.graphics.polygon("fill", unpack(myShape:getPoints()))

Re: Trouble with PolygonShape:GetPoints

Posted: Fri Apr 23, 2010 6:14 am
by jbm222
Dumb mistake.... I tried to do myShape.getPoints() instead of myShape:getPoints(). Told you I'm new to lua.

Re: Trouble with PolygonShape:GetPoints

Posted: Fri Apr 23, 2010 7:40 am
by bartbes
nevon wrote:I think you need to do:

Code: Select all

love.graphics.polygon("fill", unpack(myShape:getPoints()))
It's not returning a table...