Get in Touch

Course Outline

Introduction to Lua

  • Historical background
  • Design goals, features, and non-goals
  • Documentation and tutorial resources
  • Installing the Lua interpreter
  • Setting up and utilizing LuaRocks

Basic syntax and semantics

  • Identifiers
  • Standard 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
  • Reference 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

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

Basic control structures

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

Error handling

  • Return values versus exceptions
  • Converting return values into exceptions
  • Converting exceptions into return values
  • Error levels

Example programs

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

Advanced functions

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

Iterators and co-routines

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

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
  • Organizing modules into packages

Object-oriented programming

  • Core building blocks of OOP in Lua
  • Practical examples

Discussion on more advanced language features

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

Requirements

Students should possess familiarity with at least one other programming language and have some prior programming experience. Additionally, having exposure to other scripting languages can facilitate a smoother understanding of Lua.

 14 Hours

Upcoming Courses

Related Categories