Lua
Lua Tables and Objects
The table is Lua's only data structure, and you build arrays, dictionaries, objects and classes out of it.
Start the trackFree, no sign-up needed
What you'll learn
- TablesAn array and a dictionary in one structure
- Looping over a tableipairs for lists and pairs for dictionaries
- The table libraryInsert, remove, join and sort
- Tables inside tablesSafe access to deep fields
- Holes in listsRemove with table.remove, not nil
- Default valuessetmetatable and the __index field
- A class from a tableMethods, self and the colon
- Inheritance with tablesBuild on the parent and override its method
- Operators on your objectsDefine addition, equality, comparison and string conversion
- Turning a table into a stringRecursion and a fixed key order
Track contents
10 lessons, 2 hours in total- 1TablesLuaAn array and a dictionary in one structure11 min
- 2Looping over a tableLuaipairs for lists and pairs for dictionaries11 min
- 3The table libraryLuaInsert, remove, join and sort13 min
- 4Tables inside tablesLuaSafe access to deep fields12 min
- 5Holes in listsLuaRemove with table.remove, not nil13 min
- 6Default valuesLuasetmetatable and the __index field12 min
- 7A class from a tableLuaMethods, self and the colon14 min
- 8Inheritance with tablesLuaBuild on the parent and override its method14 min
- 9Operators on your objectsLuaDefine addition, equality, comparison and string conversion14 min
- 10Turning a table into a stringLuaRecursion and a fixed key order15 min