Pool Sample Game

Hi Can someone explaing the following code sniplet to me?
[lua]-- Arrange balls in triangle formation
for i = 1, 5 do
for j = 1, (6-i) do
n = n + 1
ball[n] = display.newImage( “ball_” … ballColors[n] … “.png” )
ball[n].x = 279 + (j*30) + (i*15)
ball[n].y = 185 + (i*26)

physics.addBody( ball[n], ballBody )
ball[n].linearDamping = 0.3 – simulates friction of felt
ball[n].angularDamping = 0.8 – stops balls from spinning forever
ball[n].id = “ball” – store object type as string attribute
ball[n].color = ballColors[n] – store ball color as string attribute
end
end [/lua]

I understand most of it but not

for i = 1, 5 do
for j = 1, (6-i) do
n = n + 1
Thanks! [import]uid: 13743 topic_id: 5391 reply_id: 305391[/import]

Looks like that’s code to set up the initial balls. First loop does 5 balls, 2nd loop does 4, then 3, 2, and 1. Rack em up!
[import]uid: 9659 topic_id: 5391 reply_id: 18020[/import]

haha I feel dumb… thanks! [import]uid: 13743 topic_id: 5391 reply_id: 18024[/import]