You aren’t giving us quite enough info here about the error but my guess is perhaps Rect isn’t a table? Here is one example of how this would work;
[lua]local Rect = {}
for i = 1, 5 do
Rect[i] = display.newRect( i*20, i*20, 20, 20 )
end
local function renew()
for i = 1, 5 do
Rect[i]:setFillColor(255, 0, 0)
end
end
renew()[/lua]
(Keep in mind you could use #Rect rather than 5 on line 8)
Or if you aren’t creating them in a loop you could do;
[lua]local Rect = {}
Rect[1] = display.newRect( 20, 20, 20, 20 )
Rect[2] = display.newRect( 90, 200, 20, 25 )
Rect[3] = display.newRect( 220, 300, 30, 20 )
local function renew()
for i = 1, #Rect do
Rect[i]:setFillColor(255, 0, 0)
end
end
renew()[/lua]
(In that second example I use #Rect)
I hope this helps 
Peach
[import]uid: 52491 topic_id: 25685 reply_id: 103850[/import]