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
- A brief history of Lua
- Core objectives, features, and limitations of Lua
- Accessing Lua documentation and learning resources
- Installing the Lua interpreter
- Configuring and utilizing LuaRocks
Basic syntax and semantics
- Understanding identifiers
- Writing comments and block comments
- Global variables and enforcing strict variable scoping
- Local variables
- Executing standalone programs and managing program arguments
- Compilation units, chunks, expressions, and the role of semicolons
Data types and data structures
- Fundamental types: nil, boolean, number, and string
- Object types: function, userdata, thread, and 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
- The if then elseif else end construct
- The while loop
- The repeat loop
- The simple for loop
Error handling
- Contrasting return values with exceptions
- Converting return values into exceptions
- Converting exceptions back into return values
- Understanding error levels
Example programs
- Polynomial evaluation
- Breadth-first search algorithms
- Additional supplementary exercises
Deep dive into functions
- Implementing named arguments
- Object-oriented method calls
- Understanding closures
- Currying techniques
- Tail calls
- Multiple assignment and return values
- Handling variable arguments (Varargs)
Iterators and co-routines
- The generic for loop
- Distinctions between stateless and stateful iterators
- Key differences between iterators and co-routines
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 existing modules
- Constructing custom modules
- Organizing modules into cohesive packages
Advanced tables
- Implementing queues and stacks with tables
- Representing graphs using tables
- Creating matrices with tables
- Building linked lists with tables
- Using tables as string buffers
Metatables through practical examples
- Implementing proxies
- Enforcing read-only behavior
- Applying memoization
- Dynamic programming with memoization
- Calculating Fibonacci sequences as an example
Environments
- The connection between global variables and environments
- Understanding free variables
- The _ENV and _G tables
Exploring modules further
- Various strategies for creating modules
- Modules that modify behavior
- Module initialization and argument handling
- Leveraging environments to build safe modules
Advanced iterators and co-routines
- Implementing producers, consumers, and filters
- Wrapping co-routines to create iterators
- Creating stateless iterators for linked lists
Contributing to the Lua Ecosystem
- Publishing packages to MoonRocks
Functional paradigm in Lua
- The map function
- The reduce (or fold) function
Object-oriented Programming
- Various approaches to implementing OOP
- Strategies for handling inheritance
- Practical examples
A walkthrough of the Lua Standard Libraries
Compilation
- Compilation processes
- Execution via Eval
- Interaction with the environment
- Working with binary chunks
Garbage collection
- Using weak tables
- Finalizers and the __gc meta-method
Lua bytecode and virtual machine
- Generating bytecode from source code
- Reading and analyzing bytecode
- A brief overview of the Lua VM source code
C modules
- Invoking C functions from Lua
- Search paths and loading C modules
Calling Lua from C
- Understanding the Stack
- Error handling mechanisms
- Implementing continuations
Handling Lua values and types from C
- Managing arrays
- Manipulating strings
- Handling userdata
- Working with metatables
- Executing object-oriented calls
- Utilizing light userdata
Memory management
- Custom allocators
- The GC API
Threads in Lua
- Comparing co-routines with threads
- Real multi-threading and Lua states
Requirements
Participants should have familiarity with at least one other programming language and possess general programming experience. While not mandatory, prior exposure to other scripting languages will facilitate a smoother learning curve for understanding Lua.
21 Hours