Get in Touch
 Duration 14 hours

Course Outline

Introduction to Lua

  • Historical background
  • Lua's objectives, characteristics, and non-objectives
  • Accessing Lua documentation and tutorials
  • Installing the Lua interpreter
  • Configuring and utilizing LuaRocks

Foundational syntax and semantics

  • Identifiers
  • Comments and block comments
  • Global variables and strictness enforcement
  • Local variables
  • Standalone programs and command-line arguments
  • Compilation units, chunks, expressions, and semicolons

Data types and structures

  • Primitive types: nil, boolean, number, string
  • Reference types: function, userdata, thread, table
  • Distinction between references/objects and basic values
  • The central role of tables in Lua

Exploring tables and their flexibility

  • Tables as associative arrays
  • Tables as numeric arrays or sequences

Core control structures

  • Conditional logic using if, then, elseif, else, and end
  • The while loop
  • The repeat loop
  • The basic for loop

Managing errors

  • Comparing return values and exceptions
  • Converting return values into exceptions
  • Converting exceptions into return values
  • Understanding error levels

Practical program examples

  • Evaluating polynomials
  • Implementing breadth-first search
  • Additional practical exercises

Advanced function concepts

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

Iterators and coroutines

  • The generic for loop
  • Distinguishing stateless and stateful iterators
  • Differences between iterators and coroutines

Metatables and metamethods

  • Implementing a set data structure
  • The __tostring metamethod
  • Arithmetic operations via 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 components of OOP in Lua
  • Practical examples

Discussion on advanced language capabilities

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

Requirements

Students should have familiarity with at least one other programming language and prior programming experience. While not mandatory, knowledge of other scripting languages may facilitate a smoother understanding of Lua.

Number of participants


Price per participant

Upcoming Courses

Related Categories