How to reference data in an array (lua table?)

I’ve been going over the code university, the text files, but I’m not understanding this bit.

I want to make an array 20x20, and be able to read data at any single point (5,7 etc.) I can’t seem to find any unique entries to call a specific point. It seems, to my eyes, like all the data storage are called the same thing, so I don’t see how to find specific data. I understand that a SQL db would sort of do what I am looking for, but I’d like to wrap my head around how lua tables work. Is there a less general tutorial out there?

Thanks in advance.

Lua technically does not support multi-dimensional arrays. But you can do arrays of arrays:

local my2Darray = {} for row  = 1, 20 do      my2Darray[row] = {}      for col = 1, 20 do          my2Darray[row][col] = whatever Value you want here: table, string, number, boolean, function, etc.      end end local myValue = my2Darray[5][7]

Reminder, Lua doesn’t actually support “Arrays”, but “Tables indexed numbers” which are for all intents arrays.

Rob

Lua technically does not support multi-dimensional arrays. But you can do arrays of arrays:

local my2Darray = {} for row  = 1, 20 do      my2Darray[row] = {}      for col = 1, 20 do          my2Darray[row][col] = whatever Value you want here: table, string, number, boolean, function, etc.      end end local myValue = my2Darray[5][7]

Reminder, Lua doesn’t actually support “Arrays”, but “Tables indexed numbers” which are for all intents arrays.

Rob