For loop

Can i display 10 rects using the for loop function??

local rects = {} for i = 1, 10 do rects[i] = display.newRect( 0, 0, 10, 10 ) rects[i].x = 20 \* i rects[i].y = 20 \* i rects[i]:setFillColor( 1, 1, 1 ) end

You will of course want to change the x/y values to suit.

Hope this helps.

local rects = {} for i = 1, 10 do rects[i] = display.newRect( 0, 0, 10, 10 ) rects[i].x = 20 \* i rects[i].y = 20 \* i rects[i]:setFillColor( 1, 1, 1 ) end

You will of course want to change the x/y values to suit.

Hope this helps.