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
- Goals, features, and design constraints of Lua
- Accessing Lua documentation and tutorials
- Installing the Lua interpreter
- Setting up and utilizing LuaRocks
Basic syntax and semantics
- Identifiers
- Comments and block comments
- Global variables and strict mode enforcement
- Local variables
- Standalone programs and argument handling
- 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 primitive values
- The central role of tables in Lua
Introduction to tables and their versatility
- Using tables as associative arrays
- Using tables as numeric arrays or sequences
Basic control structures
- Conditional logic: if, then, elseif, else, end
- The while loop
- The repeat loop
- The simple for loop
Error handling
- Return values versus exceptions
- Converting return values into exceptions
- Converting exceptions into return values
- Error levels
Example programs
- Polynomial evaluation
- Breadth-first search
- Additional practical exercises
More about functions
- Named arguments
- Object-oriented call syntax
- Closures
- Currying
- Tail calls
- Multiple assignment and return
- Variable arguments (varargs)
Iterators and co-routines
- The generic for loop
- Stateless versus stateful iterators
- Distinguishing between iterators and co-routines
Metatables and metamethods
- The set implementation example
- The __tostring metamethod
- Arithmetic metamethods
- The __index and __newindex metamethods
- The __len metamethod
Modules and packages
- Utilizing existing modules
- Creating custom modules
- Organizing modules into packages
Object-oriented programming
- Foundational OOP concepts in Lua
- Practical examples
Discussion on more advanced language features
- Weak tables
- Finalizers
- Compilation, eval, and loading mechanisms
Requirements
You should have familiarity with at least one other programming language and possess general programming experience. While not mandatory, prior exposure to other scripting languages can facilitate a smoother understanding of Lua.