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
- Historical background
- Design goals, key features, and limitations
- Documentation and tutorial resources
- Installing the Lua interpreter
- Configuration and utilization of LuaRocks
Foundational syntax and semantics
- Variable naming conventions
- Inline and block comments
- Global variables and strict mode enforcement
- Local scope variables
- Standalone execution and program arguments
- Compilation units, code chunks, expressions, and delimiters
Data types and structures
- Primitive types: nil, boolean, number, string
- Reference types: function, userdata, thread, table
- Distinction between references/objects and primitive values
- The central role of tables in Lua
Exploring tables and their flexibility
- Tables as associative arrays
- Tables as numeric arrays or sequences
Essential control structures
- Conditional logic: if, then, elseif, else, end
- The while loop
- The repeat loop
- Basic for loops
Error management
- Return values versus exceptions
- Transforming return values into exceptions
- Catching exceptions as return values
- Managing error levels
Practical program examples
- Evaluating polynomials
- Breadth-first search algorithm
- Supplementary practice exercises
Advanced function concepts
- Named parameters
- Object-oriented method calls
- Closures
- Currying techniques
- Tail call optimization
- Multiple assignment and return values
- Variable-length argument lists (Varargs)
Iterators and coroutines
- The generic for loop
- Stateless versus stateful iterators
- Distinguishing between iterators and coroutines
Metatables and metamethods
- Implementing a set data structure
- The __tostring metamethod
- Arithmetic operation overrides
- Indexing and assignment via __index and __newindex
- The __len metamethod
Modules and packages
- Utilizing existing modules
- Developing custom modules
- Structuring modules into packages
Object-oriented programming
- Foundational OOP principles in Lua
- Practical implementation examples
Exploration of advanced language features
- Weak tables
- Finalizers
- Dynamic compilation, evaluation, and code loading
Requirements
Practical experience with at least one other programming language is required. While familiarity with other scripting languages is optional, it may facilitate a smoother understanding of Lua's syntax and logic.