Get in Touch

Course Outline

Introduction to Lua

  • A brief historical overview
  • Lua's design goals, key features, and non-goals
  • Accessing Lua documentation and tutorials
  • Installing the Lua interpreter
  • Configuring and utilizing LuaRocks

Basic syntax and semantics

  • Identifiers
  • Standard and block comments
  • Global variables and enforcing strict mode
  • Local variable scope
  • Standalone programs and handling program arguments
  • Compilation units, chunks, expressions, and semicolon usage

Data types and data structures

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

Introduction to tables and their versatility

  • Using tables as associative arrays
  • Using tables as numeric arrays or sequences

Basic control structures

  • Conditional logic with if, then, elseif, else, and end
  • The while loop
  • The repeat loop
  • The simple for loop

Error handling

  • Comparing return values and exceptions
  • Converting return values into exceptions
  • Converting exceptions into return values
  • Managing error levels

Example programs

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

More about functions

  • Utilizing named arguments
  • Object-oriented method calls
  • Closures
  • Currying techniques
  • Tail calls
  • Multiple assignment and multiple return values
  • Variable-length arguments (varargs)

Iterators and co-routines

  • The generic for loop mechanism
  • Distinguishing between stateless and stateful iterators
  • Key differences between iterators and co-routines

Metatables and metamethods

  • Implementing a set data structure
  • The __tostring metamethod
  • Arithmetic metamethods
  • The __index and __newindex metamethods
  • The __len metamethod

Modules and packages

  • Consuming existing modules
  • Developing custom modules
  • Organizing modules into packages

Object-oriented programming

  • Core OOP building blocks in Lua
  • Practical examples

Discussion on more advanced language features

  • Weak tables
  • Finalizers
  • Compilation, evaluation, and loading mechanisms

Requirements

Basic familiarity with at least one other programming language and general programming experience are required. Prior exposure to other scripting languages is optional but may facilitate a smoother understanding of Lua.

 14 Hours

Number of participants


Price per participant

Upcoming Courses

Related Categories