Hi, This is driving me nuts - I can’t get it to work and when I do smaller test in simple project, it works…
I am having a table with an object reference and an name - so that I can find it.
So this is how I am filling up the table:
myLoader[loadCount] = {}
myLoader[loadCount].obj = SpriteHelperLoader:initWithContentOfFileFromSubfolder("stage/", row.sheet)
myLoader[loadCount].name = animalID
And this is the code where I am trying to delete from.
for j = 1,table.getn( myLoader ) ,1 do
print(myLoader[j].name, id, #myLoader)
end
for i = 1, table.getn( myLoader ) ,1 do
if myLoader[i].name== id then
print("Deleting : " ..myLoader[i].name, i)
-- Remove loader from memory
myLoader[i].obj:removeSelf();
--Remove line from table
table.remove(myLoader, i)
break;
end
end
Before I delete a item, i am adding a new.
The first time it comes in to the delete function, everything seems fine. It is stating by the first loop that we have 5 entries. The second time I am trying to delete another entry i am getting errors within the first print loop, even that it claims that there are 6 entries.
Help, kneedeep in code shit now…
[import]uid: 81188 topic_id: 23194 reply_id: 323194[/import]