Get in Touch

Course Outline

Introduction to Lua

  • Historical background
  • Lua's objectives, features, and limitations
  • 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 strict mode
  • Local variables
  • Standalone programs and command-line 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 between references/objects and primitive values
  • The central role of tables in Lua

Introduction to tables and their versatility

  • Tables as associative arrays
  • Tables as numeric arrays and sequences

Basic control structures

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

Error handling

  • Differences between return values and exceptions
  • Converting a return value into an exception
  • Converting an exception into a return value
  • Error levels

Example programs

  • Polynomial evaluation
  • Breadth-first search implementation
  • Additional exercises

Deeper dive into functions

  • Named arguments
  • Object-oriented method calls
  • Closures
  • Currying
  • Tail calls
  • Multiple assignment and return
  • Variable arguments (Varargs)

Iterators and coroutines

  • The generic for loop
  • Stateless versus stateful iterators
  • Key differences between iterators and coroutines

Metatables and metamethods

  • Implementing sets using metatables
  • The __tostring metamethod
  • Arithmetic metamethods
  • The __index and __newindex metamethods
  • The __len metamethod

Modules and packages

  • Using modules
  • Creating custom modules
  • Organizing modules into packages

Object-oriented programming

  • Core building blocks of OOP in Lua
  • Practical examples

Discussion on advanced language features

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

Requirements

A basic familiarity with at least one other programming language and some programming experience are recommended. Additionally, prior knowledge of other scripting languages can facilitate a smoother understanding of Lua.

 14 Hours

Number of participants


Price per participant

Upcoming Courses

Related Categories