Hi - I want to store data for my game in Lua tables but they’re not working. I’m storing the data in modules so it’s easy to reuse across components. An example would look like this:
local M = {
1 = { 1 },
2 = { 1, 1 },
3 = { 2, 1 },
6 = { 1, 2, 3 },
10 = { 2, 3 },
}
return M
This shows the information for the enemy waves in my game. The indices refer to the wave, and the values are the enemies that will appear in that wave.
Note that I skip indices, they are not sequential.
When I try to run this I get the error:
/data/waves.lua
Line 2: Compilation failed: '}' expected (to close '{' at line 1) near '='
What have I done wrong?
Thanks!