Get in Touch

Course Outline

Introduction to Lua

  • A brief history of Lua
  • Objectives, features, and limitations of Lua
  • Accessing Lua documentation and tutorial resources
  • Installing the Lua interpreter
  • Configuring and utilizing LuaRocks

Basic syntax and semantics

  • Identifiers
  • Comments and block comments
  • Global variables and strict mode enforcement
  • Local variables
  • Standalone programs 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
  • Differences 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
  • While loops
  • Repeat-until loops
  • Simplified for loops

Error handling

  • Return values versus exceptions
  • Transforming return values into exceptions
  • Converting exceptions back to return values
  • Understanding error levels

Example programs

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

Deeper dive into functions

  • Named arguments
  • Object-oriented invocation syntax
  • Closures
  • Currying
  • Tail calls
  • Multiple assignment and return values
  • Variable arguments (varargs)

Iterators and coroutines

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

  • Loading and using modules
  • Creating custom modules
  • Structuring modules into packages

Object-oriented programming

  • Core components of OOP in Lua
  • Practical examples

Advanced language features

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

Requirements

Participants should have prior familiarity with at least one other programming language. Practical programming experience is recommended. Additionally, knowledge of other scripting languages can facilitate a smoother learning curve for understanding Lua's syntax and concepts.

 14 Hours

Number of participants


Price per participant

Provisional Upcoming Courses (Require 5+ participants)

Related Categories