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 limitations of Lua
- Available documentation and tutorial resources
- Installing the Lua interpreter
- Configuring and utilizing LuaRocks
Basic syntax and semantics
- Identifiers
- Comments and block comments
- Global variables and strict mode enforcement
- Local variables
- Running standalone scripts and handling 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 pivotal role of tables in Lua
Introduction to tables and their versatility
- Tables functioning as associative arrays
- Tables functioning as numeric arrays and sequences
Basic control structures
- Conditional statements: if, then, elseif, else, end
- The while loop
- The repeat loop
- The simple for loop
Error handling
- Contrasting return values with exceptions
- Transforming return values into exceptions
- Transforming exceptions into return values
- Understanding error levels
Example programs
- Evaluating polynomials
- Breadth-first search implementation
- Additional practice exercises
More about functions
- Named arguments
- Object-oriented function calls
- Closures
- Currying
- Tail calls
- Multiple assignment and return statements
- Varargs
Iterators and co-routines
- The generic for loop
- Stateless versus stateful iterators
- Distinguishing between iterators and co-routines
Metatables and metamethods
- Implementing sets
- The __tostring metamethod
- Arithmetic metamethods
- The __index and __newindex metamethods
- The __len metamethod
Modules and packages
- Utilizing existing modules
- Creating new modules
- Organizing modules into packages
Advanced tables
- Implementing queues and stacks with tables
- Representing graphs using tables
- Matrices as tables
- Linked lists as tables
- String buffers
Metatables through examples
- Proxies
- Read-only implementations
- Memoization
- Dynamic programming using memoization
- The Fibonacci sequence example
Environments
- The relationship between global variables and environments
- Free variables
- The _ENV and _G tables
More about modules
- Various approaches to module creation
- Modules that modify behavior
- Module initialization and argument passing
- Using environments to build secure modules
Advanced iterators and co-routines
- Producer, consumer, and filter patterns
- Wrapping co-routines to create iterators
- 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 OOP approaches
- Inheritance strategies
- Practical examples
A walkthrough of the Lua Standard Libraries
Compilation
- Compilation processes
- Evaluation
- Interactions with the environment
- Binary chunks
Garbage collection
- Weak tables
- Finalizers and the __gc meta-method
Lua bytecode and virtual machine
- Generating bytecode from source code
- Reading and analyzing bytecode
- Overview of the Lua VM source code
C modules
- Calling C code from Lua
- Search paths and loading C modules
Calling Lua from C
- The Stack
- Error handling
- 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
Proficiency in at least one other programming language is required. Prior programming experience is essential. Familiarity with other scripting languages is optional but helpful for grasping Lua concepts more quickly.
21 Hours