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 background
- Lua's objectives, key features, and limitations
- Accessing Lua documentation and tutorials
- Installing the Lua interpreter
- Configuring and utilizing LuaRocks
Basic syntax and semantics
- Identifiers
- Single-line and block comments
- Global variables and strict mode enforcement
- Local variables
- Standalone programs and command-line arguments
- Compilation units, chunks, expressions, and semicolons
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 critical role of tables in Lua
Introduction to tables and their versatility
- Tables as associative arrays
- Tables as numeric arrays and sequences
Basic control structures
- If, then, elseif, else, and end statements
- While loops
- Repeat-until loops
- Simple for loops
Error handling
- Distinguishing return values from exceptions
- Converting return values into exceptions
- Converting exceptions into return values
- Understanding error levels
Example programs
- Polynomial evaluation
- Breadth-first search algorithms
- Additional practice exercises
More about functions
- Named arguments
- Object-oriented method calls
- Closures
- Currying
- Tail calls
- Multiple assignment and return statements
- Variable arguments (Varargs)
Iterators and co-routines
- The generic for loop
- Stateless versus 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
- Using modules
- Creating modules
- Organizing modules into packages
Advanced tables
- Implementing queues and stacks with tables
- Representing graphs using tables
- Utilizing tables for matrices
- Implementing linked lists with tables
- Using tables for string buffers
Metatables through examples
- Creating proxies
- Implementing read-only objects
- Memoization techniques
- Dynamic programming with memoization
- The Fibonacci sequence example
Environments
- The relationship between global variables and environments
- Understanding free variables
- The _ENV table and the _G table
More about modules
- Different strategies for creating modules
- Modules that alter behavior
- Module initialization and arguments
- Leveraging environments for secure modules
Advanced iterators and co-routines
- Producer, consumer, and filter patterns
- Wrapping co-routines to create iterators
- Implementing stateless iterators for linked lists
Contributing to the Ecosystem
- Uploading packages to MoonRocks
Functional paradigm in Lua
- The map function
- The reduce (fold) function
Object-oriented Programming
- Various approaches to OOP
- Methods for implementing inheritance
- Practical examples
A walkthrough of the Lua Standard Libraries
Compilation
- Compilation processes
- Evaluation techniques
- Relationship with the environment
- Binary chunks
Garbage collection
- Weak tables
- Finalizers and the __gc metamethod
Lua bytecode and virtual machine
- Generating bytecode from source code
- Reading and analyzing bytecode
- A quick tour of the Lua VM source code
C modules
- Invoking C from Lua
- Search paths and loading C modules
Calling Lua from C
- The stack mechanism
- Error handling procedures
- Continuations
Handling Lua values and types from C
- Arrays
- Strings
- Userdata
- Metatables
- Object-oriented calls
- Light userdata
Memory management
- Allocators
- GC API
Threads in Lua
- Co-routines versus threads
- True multi-threading and Lua states
Requirements
Participants should have familiarity with at least one other programming language. Prior programming experience is required. While not mandatory, experience with other scripting languages will facilitate a smoother learning curve.
21 Hours