Trouble with PolygonShape:GetPoints

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
jbm222
Prole
Posts: 4
Joined: Fri Apr 23, 2010 5:26 am

Trouble with PolygonShape:GetPoints

Post 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.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Trouble with PolygonShape:GetPoints

Post by nevon »

I think you need to do:

Code: Select all

love.graphics.polygon("fill", unpack(myShape:getPoints()))
jbm222
Prole
Posts: 4
Joined: Fri Apr 23, 2010 5:26 am

Re: Trouble with PolygonShape:GetPoints

Post by jbm222 »

Dumb mistake.... I tried to do myShape.getPoints() instead of myShape:getPoints(). Told you I'm new to lua.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Trouble with PolygonShape:GetPoints

Post 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...
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests