Whenever i try to call the :unpack() function of the polygon I created using the Collider:addPolygon function I get an error saying the field unpack() is a nil value.
This is how the polygon-table is created:
local points = ranPoly(damage, 20)
local e = col:addPolygon(unpack(points))
e.damage = damage
e.color = color
e.speed = speed
e.health = health
e.maxHealth = health
e.enemyType = enemytype
return e
end
enemy.list[#enemy.list + 1] = newEnemy(x, y, damage, speed, color, enemytype, health)
local points = ranPoly(damage, 20)
local e = col:addPolygon(unpack(points))
e.damage = damage
e.color = color
e.speed = speed
e.health = health
e.maxHealth = health
e.enemyType = enemytype
return e
end
enemy.list[#enemy.list + 1] = newEnemy(x, y, damage, speed, color, enemytype, health)
Yeah, I wrote it that way before but I read somewhere that the shape tables cannot be copied that easy (for some reason I didn't understand ). I thus changed it.
Returning it to the way you suggested it didn't help. I still can't call :unpack()...