Thank you for sending your enquiry! One of our team members will contact you shortly.
Thank you for sending your booking! One of our team members will contact you shortly.
Duration 14 hours
Course Outline
Introduction to Lua
- Brief historical context
- Lua’s objectives, features, and non-goals
- Documentation and tutorial resources for Lua
- Installing the Lua interpreter
- Configuring and utilizing LuaRocks
Basic syntax and semantics
- Identifiers
- Comments and block comments
- Global variables and enforcing strictness
- Local variables
- Standalone programs and program arguments
- Compilation units, chunks, expressions, and semicolons
Data types and data structures
- Basic types: nil, boolean, number, string
- Object types: function, userdata, thread, table
- References/objects versus basic values
- The significance of tables in Lua
Overview of tables and their versatility
- Tables as associative arrays
- Tables as numeric arrays or sequences
Basic control structures
- The if then elseif else end syntax
- The while loop
- The repeat loop
- The simple for loop
Error handling
- Return values versus exceptions
- Converting return values to exceptions
- Converting exceptions to return values
- Error levels
Example programs
- Polynomial evaluation
- Breadth-first search
- Supplementary exercises
Advanced function concepts
- Named arguments
- Object-oriented calls
- Closures
- Currying
- Tail calls
- Multiple assignment and return
- Variable arguments (Varargs)
Iterators and co-routines
- The generic for loop
- Stateless versus stateful iterators
- Differences between iterators and co-routines
Metatables and metamethods
- The set example
- The __tostring metamethod
- Arithmetic metamethods
- The __index and __newindex metamethods
- The __len metamethod
Modules and packages
- Using modules
- Creating modules
- Organizing modules into packages
Object-oriented programming
- Foundational components of OOP in Lua
- Practical examples
Discussion of advanced language features
- Weak tables
- Finalizers
- Compilation, eval, and loading
Requirements
Knowledge of at least one other programming language and general programming experience. Prior familiarity with other scripting languages is optional but can facilitate the understanding of Lua.