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.
Course Outline
Introduction to Lua
- Historical context
- Objectives, features, and non-goals of Lua
- Accessing Lua documentation and tutorial resources
- Installation of the Lua interpreter
- Configuration and usage of LuaRocks
Core syntax and semantics
- Identifier rules
- Comments and block comments
- Global variables and enforcing strictness
- Local variables
- Standalone execution and program arguments
- Compilation units, chunks, expressions, and semicolons
Data types and structures
- Primitive types: nil, boolean, number, string
- Object types: function, userdata, thread, table
- Distinction between references/objects and primitive values
- The critical role of tables in Lua
Table fundamentals and versatility
- Tables as associative arrays
- Tables as numeric arrays and sequences
Essential control structures
- Conditional logic: if, then, elseif, else, end
- The while loop
- The repeat loop
- The basic for loop
Error management
- Return values versus exceptions
- Transforming return values into exceptions
- Transforming exceptions into return values
- Error levels
Practical applications
- Evaluating polynomials
- Breadth-first search implementation
- Supplementary exercises
Advanced function concepts
- Named parameters
- Object-oriented invocation
- Closures
- Currying
- Tail calls
- Multiple assignment and return values
- Varargs
Iterators and coroutines
- The generic for loop
- Stateless versus stateful iterators
- Distinctions between iterators and coroutines
Metatables and metamethods
- Implementing sets as an example
- The __tostring metamethod
- Arithmetic metamethods
- The __index and __newindex metamethods
- The __len metamethod
Modules and packages
- Utilizing modules
- Building modules
- Structuring modules into packages
Object-oriented programming
- Foundations of OOP in Lua
- Practical examples
Exploration of advanced language features
- Weak tables
- Finalizers
- Compilation, evaluation, and loading
Requirements
Basic familiarity with at least one other programming language is required, along with general programming experience. While optional, prior exposure to other scripting languages can facilitate a smoother understanding of Lua concepts.
14 Hours