Get in Touch

Course Outline

Introduction to Lua

  • Historical context
  • Lua's objectives, features, and limitations
  • Accessing Lua documentation and tutorial resources
  • Installing the Lua interpreter
  • Configuring and utilizing LuaRocks

Core syntax and semantics

  • Identifiers
  • Single-line and block comments
  • Global variables and enforcing strict variable declaration
  • Local variables
  • Executing standalone programs and handling command-line arguments
  • Compilation units, code chunks, expressions, and the role of semicolons

Data types and structures

  • Primitive types: nil, boolean, number, and string
  • Reference types: function, userdata, thread, and table
  • Distinguishing between references/objects and primitive values
  • The central role of tables in Lua

Understanding tables and their versatility

  • Tables as associative arrays
  • Tables functioning as numeric arrays and sequences

Fundamental control structures

  • The if then elseif else end construct
  • The while loop
  • The repeat loop
  • The simple for loop

Error handling strategies

  • Distinguishing between return values and exceptions
  • Transforming return values into exceptions
  • Converting exceptions back to return values
  • Understanding error levels

Practical programming examples

  • Evaluating polynomials
  • Implementing breadth-first search
  • Supplementary exercises

Deep dive into functions

  • Named arguments
  • Object-oriented method calls
  • Closures
  • Currying
  • Tail calls
  • Multiple assignment and return statements
  • Variable arguments (Varargs)

Iterators and coroutines

  • The generic for loop
  • Stateless versus stateful iterators
  • Key differences between iterators and coroutines

Metatables and metamethods

  • Implementing sets using metatables
  • The __tostring metamethod
  • Arithmetic metamethods
  • The __index and __newindex metamethods
  • The __len metamethod

Modules and packaging

  • Importing and using modules
  • Creating custom modules
  • Organizing modules into packages

Advanced table applications

  • Implementing queues and stacks with tables
  • Representing graphs via tables
  • Matrices as tables
  • Linked lists implemented as tables
  • String buffers

Metatables in practice

  • Proxies
  • Read-only objects
  • Memoization
  • Dynamic programming techniques using memoization
  • The Fibonacci sequence example

Environments

  • The connection between global variables and environments
  • Free variables
  • The _ENV and _G tables

Further module development

  • Various methodologies for creating modules
  • Modules that alter behavior
  • Module initialization and argument passing
  • Utilizing environments for secure module implementation

Advanced iterators and coroutines

  • Producer, consumer, and filter patterns
  • Wrapping coroutines to generate iterators
  • Creating stateless iterators for linked lists

Contributing to the ecosystem

  • Uploading packages to MoonRocks

The functional programming paradigm in Lua

  • The map function
  • The reduce/fold function

Object-Oriented Programming

  • Approaches to OOP in Lua
  • Strategies for inheritance
  • Illustrative examples

Exploration of Lua Standard Libraries

Compilation

  • Compilation processes
  • Evaluation (Eval)
  • Interactions with the environment
  • Binary chunks

Garbage collection mechanisms

  • Weak tables
  • Finalizers and the __gc meta-method

Lua bytecode and the virtual machine

  • Generating bytecode from source code
  • Reading and analyzing bytecode
  • A brief tour of the Lua VM source code

C modules

  • Invoking C code from Lua
  • Search paths and loading C modules

Calling Lua from C

  • Understanding the Stack
  • Error handling mechanisms
  • Continuations

Managing Lua values and types from C

  • Arrays
  • Strings
  • Userdata
  • Metatables
  • Object-oriented calls
  • Light userdata

Memory management

  • Allocators
  • GC API

Threads in Lua

  • Differentiating coroutines from threads
  • True multi-threading and Lua states

Requirements

A foundational understanding of at least one other programming language is required. Prior programming experience is essential. While helpful, familiarity with other scripting languages is optional but will facilitate a smoother learning process for Lua.

 21 Hours

Number of participants


Price per participant

Upcoming Courses

Related Categories