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
- A brief historical overview
- Design goals, key features, and intended limitations
- Accessing Lua documentation and tutorials
- Installing the Lua interpreter
- Configuring and utilizing LuaRocks
Basic syntax and semantics
- Identifier conventions
- Inline comments and block comments
- Global variables and strictness enforcement
- Local variable scope
- Standalone programs and handling command-line arguments
- Compilation units, code chunks, expressions, and semicolon usage
Data types and data structures
- Primitive types: nil, boolean, number, string
- Object types: function, userdata, thread, table
- Distinguishing between references/objects and primitive values
- The central role of tables in Lua
Introduction to tables and their versatility
- Tables functioning as associative arrays
- Tables acting as numeric arrays and sequences
Basic control structures
- Conditional logic with if, then, elseif, else, and end
- While loops
- Repeat loops
- Simple for loops
Error handling
- Contrasting return values with exceptions
- Converting return values into exceptions
- Catching exceptions and treating them as return values
- Error hierarchy levels
Example programs
- Evaluating polynomials
- Implementing Breadth-First Search
- Additional practical exercises
More about functions
- Using named arguments
- Object-oriented calling conventions
- Understanding closures
- Techniques for currying
- Tail calls
- Multiple assignment and return values
- Handling variable arguments (Varargs)
Iterators and co-routines
- The generic for loop
- Comparing stateless and stateful iterators
- Distinguishing between iterators and co-routines
Metatables and metamethods
- Implementing a set data structure
- The __tostring metamethod
- Arithmetic operations via metamethods
- Indexing with __index and __newindex
- The __len metamethod
Modules and packages
- Utilizing existing modules
- Developing custom modules
- Structuring modules into packages
Object-oriented programming
- Core components of OOP in Lua
- Practical implementation examples
Discussion on more advanced language features
- Working with weak tables
- Using finalizers
- Compilation, evaluation, and module loading
Requirements
Students should have familiarity with at least one other programming language and possess general programming experience. While not required, prior exposure to other scripting languages can facilitate a smoother understanding of Lua's syntax and logic.