Get in Touch
 Duration 14 hours

Course Outline

Introduction to Lua

  • A brief historical background
  • Objectives, key features, and design constraints
  • Accessing Lua documentation and learning resources
  • Installation of the Lua interpreter
  • Configuration and usage of LuaRocks

Basic syntax and semantics

  • Variable naming conventions
  • Inline and block comments
  • Global variables and strict mode enforcement
  • Local variable scope
  • Standalone execution and handling program arguments
  • Compilation units, chunks, expressions, and statement terminators

Data types and data structures

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

Introduction to tables and their versatility

  • Using tables as associative arrays (hash maps)
  • Using tables as numeric arrays or sequences

Basic control structures

  • Conditional logic with if, then, elseif, else, end
  • The while loop
  • The repeat-until loop
  • The numeric for loop

Error handling

  • Distinguishing between 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 practice exercises

Advanced function concepts

  • Passing named arguments
  • Object-oriented method calls
  • Understanding closures
  • The concept of currying
  • Tail call optimization
  • Multiple assignment and multiple return values
  • Variable-length argument lists (varargs)

Iterators and co-routines

  • The generic for loop
  • Comparing stateless and stateful iterators
  • Distinguishing between iterators and co-routines

Metatables and metamethods

  • Implementing a set data structure
  • The __tostring metamethod
  • Overriding arithmetic operations
  • The __index and __newindex metamethods
  • The __len metamethod

Modules and packages

  • Importing and using existing modules
  • Creating custom modules
  • Structuring modules into packages

Object-oriented programming

  • Core OOP principles in Lua
  • Practical examples

Discussion on more advanced language features

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

Requirements

A basic understanding of at least one other programming language is required, along with general programming experience. While not mandatory, prior familiarity with other scripting languages can facilitate a smoother transition to learning Lua.

Number of participants


Price per participant

Upcoming Courses

Related Categories