Currently I am putting together a few simple ‘teach myself codea’ programs. In my main draw function I have:
for i,s in pairs(stones) do if s.y < 0 then table.remove(stones, i) else s:draw() end end
The table stones is appended in the main touched event:
function touched(t) if t.state == BEGAN then table.insert(stones, Stone(t.x,t.y)) end end
That feels like all I am doing is dereferencing the class, not removing it, but my performance impact as the stones fall off the screen feels appropriate.
Am I doing it the right way?