0 Members and 5 Guests are viewing this topic.
function on.create() coord = {} for a=1, 14 do for b=1, 3 do if a~=7 and a~=14 then coord[a*9+b*3-11]=a --Changed all the 3s in front of the as to 9s also changed the 5, 4, and 3 to 11, 10, and 9 so that it would still start at coord[1] coord[a*9+b*3-10]=math.random(0,16) coord[a*9+b*3-9]=math.random(0,14) else coord[a*9+b*3-11]=a end end endendfunction on.paint(gc) for a=1, 42 do if coord[a*3-2]~=7 and coord[a*3-2]~=14 then if coord[a*3-2]>7 then gc:fillArc((coord[a*3-2]-7)*38+coord[a*3-1],coord[a*3]+49,10,10,0,360) --subtracted 7 from coord[a*3-2] to line up the pieces else gc:fillArc(coord[a*3-2]*38+coord[a*3-1],coord[a*3]+141,10,10,0,360) end end endend
example = {}example[1] = 1example[1337] = 3.141592example["The Game"] = on.paintexample[on.create] = "Never Gonna Give You Up"example[true] = falseexample.Omnimaga = {1, 2, 3, 4} --Same as example["Omnimaga"] = {1, 2, 3, 4}
function on.create() local array=0 coord = {} for a=1, 14 do for b=1, 3 do array = a*9+b*3-11 if a~=7 and a~=14 then coord[array]=a coord[array+1]=math.random(0,16) coord[array+2]=math.random(0,14) else coord[array]=a end end endendfunction on.paint(gc) local array=0 for a=1, 42 do array = a*3-2 if coord[array]~=7 and coord[array]~=14 then if coord[array]>7 then paintSeeds(gc,(coord[array]-7)*38+coord[array+1],coord[array+2]+ 49,10,10,0,360) else paintSeeds(gc,(coord[array]-0)*38+coord[array+1],coord[array+2]+141,10,10,0,360) end end endendfunction paintSeeds(GC, x, y, width, height, startAngle, angle) GC:setColorRGB(0, 0, 0) --change colors as pleased GC:drawArc(x-1, y-1, width+1, height+1, startAngle, angle) GC:setColorRGB(128,128,128) --change colors as pleased GC:fillArc(x, y, width, height, startAngle, angle)end
if coord[a*3-2]~=7 and coord[a*3-2]~=14 then
And also, is there an easy way to add something to the end of the table and count the number of things in a table?
function length(example) local index = 0 for _, __ in pairs(example) index = index + 1 end return indexend
stuffs = {1, 3, 5, 3, nil, "end"}function length2(example) local index = 1 while example[index] ~= "end" do index = index + 1 end return index - 1end