Get in Touch
 Duration 14 hours

Course Outline

Introduction to Lua

  • A brief historical overview
  • Design goals, key features, and non-goals of Lua
  • Accessing official Lua documentation and tutorials
  • Installing the Lua interpreter
  • Configuring and utilizing LuaRocks

Basic syntax and semantics

  • Identifier rules
  • Comments and block comments
  • Global variables and enforcing strictness
  • Local variables
  • Standalone programs and handling program arguments
  • Compilation units, chunks, expressions, and semicolons

Data types and data structures

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

Introduction to tables and their versatility

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

Basic control structures

  • Conditional logic: if, then, elseif, else, end
  • The while loop
  • The repeat loop
  • The simple for loop

Error handling

  • Distinguishing return values from exceptions
  • Converting return values into exceptions
  • Converting exceptions into return values
  • Understanding error levels

Example programs

  • Implementing polynomial evaluation
  • Implementing breadth-first search
  • Supplementary practice exercises

More about functions

  • Handling named arguments
  • Object-oriented function calls
  • Closures
  • Currying
  • Tail calls
  • Multiple assignment and return values
  • Variable arguments (Varargs)

Iterators and co-routines

  • The generic for loop
  • Comparing stateless and stateful iterators
  • Distinguishing between iterators and co-routines

Metatables and metamethods

  • Practical examples using sets
  • 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

  • Core building blocks of OOP in Lua
  • Practical examples and implementations

Discussion on more advanced language features

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

Requirements

Students should have familiarity with at least one other programming language and possess general programming experience. Prior exposure to other scripting languages is optional but may facilitate a smoother understanding of Lua's syntax and logic.

Number of participants


Price per participant

Upcoming Courses

Related Categories