[SOLVED] Nested for loop - indexing issue

Hi! I’m pretty new to Defold and Lua and I can’t for the life of me figure this out.

I’m trying to generate coordinates to store in a multidimensional table but I can’t figure out why j is just not there for the first iteration?? How do I get it to. not do that


image

Any help would be appreciated!!

If you try to print out the same thing multiple times in a row, Defold’s console will only show it once and then put a little counter to the left showing how many times the message was printed. I’m guessing that’s what happened here since both i and j will be 1 on the first iteration.

How do you mean?
It’s there, otherwise you wouldn’t be able to do j * tilesize

As Potota says, make your print easier to read: print("i/j", i, j)

:sweat_smile: You’re completely right! Sorry this is what I get for coding too late. The main issue here is that I keep getting error messages when trying to add this first instance to self.board - the issue is with something else probably. I’ll make a different and better question later. thank you for your time !!