Get in Touch
 Duration 14 hours

Course Outline

Introduction to Lua

  • Historical background
  • Objectives, features, and design non-goals of Lua
  • Accessing Lua documentation and tutorial resources
  • Installation of the Lua interpreter
  • Configuration and utilization of LuaRocks

Basic syntax and semantics

  • Identifier rules
  • Comments and block comments
  • Global variables and strict mode enforcement
  • Local variables
  • Standalone program execution and 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
  • Distinction 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: if, then, elseif, else, end
  • The while loop
  • The repeat loop
  • The simple for loop

Error handling

  • Differentiating return values from 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

  • Named arguments
  • Object-oriented function calls
  • Closures
  • Currying
  • Tail calls
  • Multiple assignment and multiple returns
  • Variable-length arguments (varargs)

Iterators and co-routines

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

Metatables and metamethods

  • Implementing sets as an example
  • The __tostring metamethod
  • Arithmetic metamethods
  • The __index and __newindex metamethods
  • The __len metamethod

Modules and packages

  • Utilizing existing modules
  • Creating custom modules
  • Structuring 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

Requirements

Experience with programming is required. Familiarity with at least one other programming language is essential. Additionally, prior knowledge of other scripting languages will facilitate a smoother understanding of Lua.

Number of participants


Price per participant

Provisional Upcoming Courses (Require 5+ participants)

Related Categories