Get in Touch
 Duration 14 hours

Course Outline

Introduction to Lua

  • Brief historical background
  • Objectives, key features, and non-goals of 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
  • Distinction between references/objects and primitive values
  • The central role of tables in Lua

Tables: Introduction and versatility

  • Using tables as associative arrays
  • Using tables as numeric arrays and sequences

Basic control structures

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

Error handling

  • Comparing return values and exceptions
  • Converting return values into exceptions
  • Converting exceptions into return values
  • Error levels

Sample programs

  • Polynomial evaluation
  • Breadth-first search
  • Supplementary exercises

Advanced function topics

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

Iterators and coroutines

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

Metatables and metamethods

  • Implementing a set data structure
  • 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

  • Foundational OOP elements in Lua
  • Practical examples

Advanced language features

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

Requirements

Basic proficiency in at least one other programming language is required. Prior programming experience is expected. Familiarity with other scripting languages is optional but may facilitate a smoother understanding of Lua concepts.

Number of participants


Price per participant

Upcoming Courses

Related Categories