I'm trying to add the co-ords to the table using loops so I don't have to add them myself but it's failing terribly:
I am able to get it to add the co-ords of the exact co-ords within the table of the walls but I want the opposite, to add the co-ords that doesn't match the ones in the walls table.
This code that matches the co-ords within the walls table.
As you can see, I have it do this:
for sx = 2, 40 do
for sy = 2, 5 do
for i = 1, #t_gameWalls do
if sx == t_gameWalls[i].x and sy == t_gameWalls[i].y then
table.insert(t_gameDots, {x = sx, y = sy, eatan = false})
break
end
end
end
end
Spoiler
That then adds the same co-ords as the one's in the t_gameWalls table, but I want it to do the opposite, so i tried this code:
for sx = 2, 40 do
for sy = 2, 5 do
for i = 1, #t_gameWalls do
if not ( sx == t_gameWalls[i].x and sy == t_gameWalls[i].y ) then -- only changed this
table.insert(t_gameDots, {x = sx, y = sy, eatan = false})
break
end
end
end
end
Which caused it to add in every space possible:
Spoiler
What I want can be achieved if I draw the t_gameWalls after the t_gameDots table but then the t_gameDots has extra unnecessary indexes.
This is what I want:
Spoiler
Not sure if I explained it properly, hope I did.