Get in Touch

Course Outline

Introduction to Lua

  • A brief historical overview
  • Design goals, key features, and non-goals
  • Essential documentation and tutorial resources
  • Installation of the Lua interpreter
  • Setup and utilization of LuaRocks

Basic syntax and semantics

  • Identifier rules
  • Single-line and block comments
  • Global variables and strict mode enforcement
  • Local variable scoping
  • Standalone program execution and arguments
  • Compilation units, chunks, expressions, and semicolons

Data types and data structures

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

Exploring 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
  • While loops
  • Repeat loops
  • Basic for loops

Error handling

  • Comparison of return values versus exceptions
  • Converting return values into exceptions
  • Converting exceptions into return values
  • Error level management

Example programs

  • Evaluating polynomials
  • Breadth-first search implementation
  • Supplementary practice exercises

Advanced function concepts

  • Named parameters
  • Object-oriented invocation styles
  • Closures
  • Currying techniques
  • Tail call optimization
  • Multiple assignment and return values
  • Variable-length arguments (varargs)

Iterators and co-routines

  • The generic for loop mechanism
  • Stateless versus stateful iterators
  • Distinguishing iterators from 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
  • 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 code loading

Requirements

Familiarity with at least one other programming language and general programming experience are required. Prior knowledge of other scripting languages is optional but can facilitate a smoother understanding of Lua.

 14 Hours

Number of participants


Price per participant

Upcoming Courses

Related Categories