Get in Touch
 Duration 14 hours

Course Outline

Introduction to Lua

  • Historical context
  • Lua’s objectives, features, and non-goals
  • Official documentation and tutorial resources
  • Installing the Lua interpreter
  • Setting up and utilizing LuaRocks

Basic syntax and semantics

  • Identifiers
  • Comments and block comments
  • Global variables and enforcing strict mode
  • 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 vs. primitive values
  • The central role of tables in Lua

Introduction to tables and their flexibility

  • Tables as associative arrays
  • Tables as numeric arrays and sequences

Basic control structures

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

Error handling

  • Return values vs. exceptions
  • Converting a return value into an exception
  • Converting an exception into a return value
  • Error levels

Example programs

  • Evaluating polynomials
  • Breadth-first search implementation
  • Additional practice exercises

Advanced function concepts

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

Iterators and co-routines

  • The generic for loop
  • Stateless vs. stateful iterators
  • Distinguishing iterators from co-routines

Metatables and metamethods

  • Implementing sets as an example
  • 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 concepts in Lua
  • Practical examples

Advanced language features

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

Requirements

Proficiency in at least one other programming language and general programming experience are required. Familiarity with other scripting languages is optional but recommended, as it can facilitate a smoother understanding of Lua.

Number of participants


Price per participant

Testimonials (1)

Upcoming Courses

Related Categories