Get in Touch
 Duration 14 hours

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
  • Setting up and utilizing LuaRocks

Basic syntax and semantics

  • Identifiers
  • Comments and block comments
  • Global variables and enforcing strictness
  • Local variables
  • Standalone programs and program arguments
  • Compilation units, chunks, expressions, and semicolons

Data types and data structures

  • Basic types: nil, boolean, number, string
  • Object types: function, userdata, thread, table
  • Distinguishing references/objects from 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 and sequences

Basic control structures

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

Error handling

  • Return values versus exceptions
  • Converting return values to exceptions
  • Converting exceptions to return values
  • Error levels

Example programs

  • Polynomial evaluation
  • Breadth-first search
  • Supplementary exercises

More about functions

  • Named arguments
  • Object-oriented calls
  • Closures
  • Currying
  • Tail calls
  • Multiple assignment and return values
  • 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

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

Modules and packages

  • Utilizing existing modules
  • Creating custom modules
  • Organizing modules into packages

Object-oriented programming

  • Core building blocks of OOP in Lua
  • Practical examples

Discussion on more advanced language features

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

Requirements

A working knowledge of at least one other programming language is required, along with general programming experience. Prior familiarity with other scripting languages is optional but recommended, as it facilitates a smoother understanding of Lua concepts.

Number of participants


Price per participant

Upcoming Courses

Related Categories