0 Members and 2 Guests are viewing this topic.
for a=1, 14 do for b=1, 3 do if a~=7 and a~=14 then coord[a*3+b*3-5]=acoord[a*3+b*3-4]=math.random(0,16) coord[a*3+b*3-3]=math.random(0,14) else coord[a*3+b*3-5]=a --coord[a*3+b*3-4] and coord[a*3+b*3-3 will be nil.end end end
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]*38+coord[a*3-1],coord[a*3]+49,10,10,0,360) -- (above) attempt to index global 'coord' (a nil value)else gc:fillArc(coord[a*3-2]*38+coord[a*3-1],coord[a*3]+141,10,10,0,360) end-- moar stuffs
if coord[a*3-2]~=7 and coord[a*3-2]~=14 then
coord = {}
I'd have 2 player mode somewhat close to finished if it wasn't for errors... Here is in the beginningCode: [Select]for a=1, 14 do for b=1, 3 do if a~=7 and a~=14 then coord[a*3+b*3-5]=a coord[a*3+b*3-4]=math.random(0,16) coord[a*3+b*3-3]=math.random(0,14) else coord[a*3+b*3-5]=a --coord[a*3+b*3-4] and coord[a*3+b*3-3 will be nil. end end end And here is where the error occursCode: [Select]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]*38+coord[a*3-1],coord[a*3]+49,10,10,0,360) -- (above) attempt to index global 'coord' (a nil value) else gc:fillArc(coord[a*3-2]*38+coord[a*3-1],coord[a*3]+141,10,10,0,360) end-- moar stuffs Coord shouldn't be nil. The only times there will be a nil value in that is supposed to be only when coord[a*3-2] is equal to 7 or 14. That shouldn't happen because it is underCode: [Select]if coord[a*3-2]~=7 and coord[a*3-2]~=14 then Unless coord[a*3+b*3-5] (from first code) isn't the same as coord[a*3-2]...
for a=1, 14 do for b=1, 3 do if a~=7 and a~=14 then coord[a*3+b*3-5]=a coord[a*3+b*3-4]=math.random(0,16) coord[a*3+b*3-3]=math.random(0,14) else coord[a*3+b*3-5]=a --coord[a*3+b*3-4] and coord[a*3+b*3-3 will be nil. end end end
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]*38+coord[a*3-1],coord[a*3]+49,10,10,0,360) -- (above) attempt to index global 'coord' (a nil value) else gc:fillArc(coord[a*3-2]*38+coord[a*3-1],coord[a*3]+141,10,10,0,360) end-- moar stuffs
coord = {}for i=1, 128 do coord[i]=0 end
for a=1, 14 do for b=1, 3 do if a%7 ~= 0 then coord[9*(a-1)+3*(b-1)+1] = a coord[9*(a-1)+3*(b-1)+2] = math.random(0,16) coord[9*(a-1)+3*(b-1)+3] = math.random(0,14) else coord[9*(a-1)+3*(b-1)+1] = a end end end