Table (as an array)
Ordered values (indexed from 1!).
Syntax
t = {e1, e2, e3}Description
The only structure in Lua is the table. When used as an array, the index starts at 1. #t gives the number of elements.
Example
Loading editor…
Expected output
10 3
When to use?
Storing lists.
Common mistakes
- ⚠️ The first element in Lua is t[1], not t[0]!