Tools for writing lua tables or converting something into a lua table

okay!

So, a long-term part of my plan is to allow people to create their own levels using a level creator within my game. This means I need to be able to generate levels from a table. Because of some problems with snap to grid, I ended up writing a system which converts this:

--0 = nothing, --1 = alex and land --2 = isabel and land --3 = donut and land --4 = tile --5 = tree and land self.levels= { --level1 {4,0,0,0,0,0,0,0,0,4, 0,0,4,0,0,0,3,0,0,0, 0,0,4,0,0,0,4,0,0,0, 0,0,4,1,4,2,4,0,0,0, 0,0,5,0,4,0,0,0,0,0, 0,0,0,0,4,5,0,0,0,0, 4,0,0,0,0,0,0,0,0,4,},

into this:

the only problem is that now, I have to write all my levels like that, by hand, and it’s a real pain in the ass.

So, here’s my weird question. Does anybody know a text editor that works a little bit like excel, and would allow me to quickly create that type of table?

1 Like

Why not use Tiled and export to json/Lua, parse that and create your level from the resulting Lua table?

1 Like

I use our builtin tile editor to paint levels.
I encode different tiles: 1 = enemy, 2 = coin, 3 = …
I also use layers.

Then, at startup, I parse the tilemap and put it in a table (or something else)

1 Like

Perfect! Britzl I assume you mean “tiles” rather than a program called tile. I’ll look into the tile editor now. Thanks team!

1 Like

I think he meant Tiled editor.

3 Likes

nice!! It literally took 5 to export my first tile map in the exact format i needed. What a life saver!

2 Likes