Remove properly

Hi,

can anyone tell me how to remove something properly from table?
say i have this:

1
2
3
4
5
6
7
8
9
10
11
12
13
local t = {img= "image.png", color = "blue", attached = "image2.png"}
local t2 = {}
 
for i=1,3 do
t2[i] = display.newImage(t[1].img)
t2[i].color = t[1].color
t2[i].attach = t[1].attached
t2[i].attach.part = display.newRect(0,0,50,50)
<lua>
 
and i need to delete it from screen properly, how can i do this? it seems complicated
 
any help is appreciated

I think you just need to remove the images and the rectangles. Color and attached are just properties of the image so should go out when you nil the images.

Something like

1
2
3
4
5
6
7
for i=1,3 do
 
display.remove (t2[i].attach.part)
display.remove(t2[i])
t2[i] = nil
 
end
views:1497 update:2011/11/28 11:38:31
corona forums © 2003-2011