I have this piece of code to destroy an object if it goes below a certain point. This code runs every frame in the "onEnterFrame" function.
for i, val in pairs(self.balls) do
if val:getY() > 500 then
However, whenever the object goes below that point, an error comes up saying:
Scenes/game.lua:74: Body is already destroyed.
I tried adding code that checks if val.body is nil, and doesn't destroy it if so, but the error message still came up. Does anybody know why this is happening?