Skip to main content

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