Lua Cheetsheet

Tables

Tables are the object in Lua, they can hold values like array (integer index) or any other index like map that is not nil.

Create table and append element

foo = {}
table.insert(foo, "bar")

Iterate table as array

for i, val in ipairs(foo) do
  print(val)
end

Revision #2
Created 2025-09-04 21:21:43 IST by H13
Updated 2025-10-05 13:58:52 IST by H13