Lua Tables

Table is Lua's only data structure. With values in braces it acts as an array, and by convention the first index is 1, not 0. table.insert adds to the end and the # operator gives the length.

Lua
local scores = {82, 91, 76}
table.insert(scores, 95)
print(#scores .. " " .. scores[1])
local person = {name = "Ada", age = 36}
person.age = person.age + 1
print(person.name .. " " .. person.age)
Read the full lesson