Get in Touch

Course Outline

Introduction to Lua

  • Historical background
  • Lua's objectives, key features, and limitations
  • Accessing Lua documentation and tutorials
  • Installing the Lua interpreter
  • Configuring and utilising LuaRocks

Basic syntax and semantics

  • Identifiers
  • Single-line and block comments
  • Global variables and enforcing strict variable declaration
  • 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
  • References and objects versus primitive values
  • The critical 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-until loop
  • The simple for loop

Error handling

  • Return values versus exceptions
  • Converting return values to exceptions
  • Converting exceptions to return values
  • Error levels and propagation

Example programs

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

More about functions

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

Iterators and co-routines

  • The generic for loop
  • Stateless versus stateful iterators
  • Differences between iterators and co-routines

Metatables and metamethods

  • Implementing a set using tables
  • The __tostring metamethod
  • Arithmetic metamethods
  • The __index and __newindex metamethods
  • The __len metamethod

Modules and packages

  • Using existing modules
  • Creating custom modules
  • Organising modules into packages

Object-oriented programming

  • Core components of OOP in Lua
  • Practical examples

Discussion on more advanced language features

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

Requirements

Participants should have prior familiarity with at least one other programming language, along with some general programming experience. While not mandatory, experience with other scripting languages can facilitate a smoother understanding of Lua.

 14 Hours

Number of participants


Price per participant

Upcoming Courses

Related Categories