Get in Touch
 Duration 14 hours

Course Outline

Introduction to Lua

  • Historical overview
  • Lua’s objectives, capabilities, and limitations
  • Available documentation and tutorial resources
  • Installation of the Lua interpreter
  • Configuration and utilization of LuaRocks

Basic syntax and semantics

  • Identifier usage
  • Single-line and block comments
  • Global variables and strict mode enforcement
  • Local variable declaration
  • Standalone execution and argument handling
  • Compilation units, code chunks, expressions, and semicolons

Data types and data structures

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

Introduction to tables and their versatility

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

Basic control structures

  • If-then-elseif-else-end logic
  • While loops
  • Repeat-until loops
  • Basic for loops

Error handling

  • Distinguishing return values from exceptions
  • Transforming return values into exceptions
  • Converting exceptions into return values
  • Managing error levels

Example programs

  • Polynomial calculation
  • Breadth-first search algorithm
  • Supplementary practical tasks

More about functions

  • Named parameter passing
  • Object-oriented invocation
  • Implementation of closures
  • Function currying
  • Tail call optimization
  • Multiple assignment and return values
  • Variable arguments (varargs)

Iterators and co-routines

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

Metatables and metamethods

  • Set data structure implementation
  • Using the __tostring metamethod
  • Arithmetic operation metamethods
  • The __index and __newindex metamethods
  • The __len metamethod

Modules and packages

  • Incorporating existing modules
  • Developing custom modules
  • Structuring modules into packages

Object-oriented programming

  • Fundamental OOP concepts in Lua
  • Practical demonstrations

Discussion on more advanced language features

  • Utilization of weak tables
  • Implementation of finalizers
  • Compilation, evaluation, and loading processes

Requirements

Prior experience with at least one programming language is required. Foundational programming knowledge is essential. Additionally, familiarity with other scripting languages can facilitate a smoother understanding of Lua.

Related Categories