Courses / Specialisations & media / Lua Programming

₹39Self-paced

Lua Programming

Build a tested Lua command-line utility that reads settings, keeps its data in files and reports errors without crashing.

  • Who it's for. Learners who already think through programs step by step and want a small, embeddable scripting language they can use from the terminal.
  • Before you start. Prerequisite courses: Programming Problem Solving. Prerequisite course Programming Problem Solving, or equivalent: you can trace a loop by hand, read pseudocode and break a task into steps.
  • 30 to 51 hours of study with practice
  • 9 modules, 52 lessons
  • 3 guided projects and a final project

What you'll learn

  • Run, parameterise and inspect Lua programs with the standalone interpreter and pick a Lua version deliberately.
  • Process and rewrite text with the string library and Lua patterns.
  • Control program flow with loops, iterators and coroutines.
  • Organise code into modules loaded with require and design small interfaces.
  • Test Lua code with plain assertions and a documented framework, and deliver a configurable command-line utility with tests and persistence.

Skills you'll gain

  • Lua interpreter
  • Values
  • tables
  • Strings
  • patterns
  • Functions
  • scope
  • Control flow
  • coroutines
  • Metatables
  • Modules
  • Errors
  • Testing
  • application project

Tools you'll use

  • Lua 5.5 (proposed pinned interpreter)
  • lua standalone interpreter
  • Lua string library and patterns
  • busted (optional, where installable)

Details to know

  • Certificate on completionIssued after your final project is reviewed
  • 9 module checkpointsA quiz and a practical task close each module
  • Self-pacedStudy any time; your progress is saved

How every lesson works

Each lesson follows the same four steps, so you always know what comes next.

  1. 01

    Watch & Learn

    A short animated video explains one idea at a time.

  2. 02

    Guided Practice

    Work through an example step by step and check the result.

  3. 03

    Quiz & Challenge

    Short questions check the idea has landed before you move on.

  4. 04

    Mini Project

    Build something useful from a project brief.

Learn at your own pace

This is a self-paced course. There are no live classes and no fixed timetable.

  • Start any timeStudy when it suits you. Lessons are short, so they fit around work or college.
  • Pick up where you left offYour progress is saved to your account.
  • Ask when you're stuckUse Ask Mentor inside the learning platform.

Your path in 4 phases

Each phase ends with something you have built and checked.

  1. 01

    Modules 1 to 3

    Lua interpreter to Strings and patterns

    Run, parameterise and inspect Lua programs with the standalone lua interpreter and choose a language version deliberately.

    You build: Guided project “Text and data toolkit”: Folder with an argument-driven skeleton using locals and a documented layout Queue, tally and deep-copy helpers over tables.

  2. 02

    Modules 4 to 6

    Functions and scope to Metatables

    Write functions with multiple results and variable arguments, treat functions as values and build closures that keep private state.

    You build: Guided project “Reusable function and object library”: Higher-order helpers, a closure-based account and an options resolver Chunk iterator and a generator pipeline.

  3. 03

    Modules 7 to 8

    Modules to Errors and IO

    Split a program into modules with require, control module search and design small stable module interfaces.

    You build: Guided project “Persistent record store with error handling”: Store implemented as a module loadable from any working directory.

  4. 04

    Module 9

    Testing and application project

    Test Lua code with plain assertions and a documented framework, then assemble a configurable, persistent command-line utility with evidence.

    You build: Final project build and trainer-reviewed demonstration (see project).

Full curriculum

9 modules and 52 lessons, 30 to 51 hours of study

01Lua interpreter5 lessons, 2 to 4 hours

Lessons

  • Running a script with the standalone interpreter
  • Command-line options: -e, -i and --
  • Script arguments and the arg table
  • Chunks, comments and local variables
  • Global declarations and choosing a Lua version

After this module you can

  • Run a one-file script with `lua file.lua`, print to standard output and report the interpreter version with `lua -v`.
  • Execute a one-line chunk with `lua -e`, run a script and then enter interactive mode with `-i`, and use `--` to stop option handling.
  • Use `global` declarations in a Lua 5.5 chunk, explain why `global` is now a reserved word, and state which lab version the course targets.
02Values and tables6 lessons, 3 to 4 hours

Lessons

  • The eight value types and the type function
  • Integers, floats and the division operators
  • Truthiness and the and, or, not operators
  • Tables as arrays: constructors, length and list functions
  • Tables as records and dictionaries
  • Tables are references: identity, shallow copies and nesting

After this module you can

  • Name Lua's eight basic types, call type() on sample values and predict the returned type name string.
  • Predict results of +, /, //, %, and ^ on integers and floats and use math.type to tell the subtypes apart.
  • Predict aliasing effects of assigning a table to a second name, write a shallow copy and a deep copy of nested data and compare tables by identity.
03Strings and patterns5 lessons, 2 to 4 hours

Lessons

  • Strings as immutable byte sequences
  • Formatting and converting with string.format, tostring and tonumber
  • Searching text with string.find and string.match
  • Pattern items: classes, sets, quantifiers and anchors
  • Iterating and rewriting text with gmatch and gsub

After this module you can

  • Use #, .., string.sub, string.rep and string.byte on a string and explain why the original string never changes.
  • Format numbers and text with string.format specifiers, convert text to numbers with tonumber (including a base) and handle conversion failure.
  • Loop over all matches with string.gmatch and rewrite text with string.gsub using a string, table or function replacement, reading the replacement count.
04Functions and scope6 lessons, 3 to 4 hours

Lessons

  • Defining functions and returning several results
  • Variable arguments with ... and select
  • Local functions, recursion and tail calls
  • Functions as values and higher-order helpers
  • Closures, upvalues and private state
  • Lexical scope, shadowing and options tables

After this module you can

  • Define a function with parameters, return more than one value, and predict how many results a caller keeps in different positions.
  • Accept any number of arguments with `...`, count them with select('#', ...) and pack or unpack them without losing nil values.
  • Trace which variable a name refers to across nested blocks, avoid accidental shadowing, and design a function taking one options table with defaults.
05Control flow and coroutines6 lessons, 3 to 4 hours

Lessons

  • Decisions with if, elseif and comparisons
  • while, repeat-until and break
  • Numeric for loops and the read-only control variable
  • Generic for, pairs, ipairs and writing iterators
  • Coroutines: create, resume, yield and status
  • Coroutines as generators, pipelines and error handling

After this module you can

  • Write if/elseif/else chains with comparison operators, predict cross-type comparison behaviour and order tests so overlapping ranges resolve correctly.
  • Write conditional loops with while and repeat-until, exit early with break, and explain that a repeat body's locals are visible in its until condition.
  • Build a generator with coroutine.wrap, chain two coroutines into a pipeline and handle an error raised inside a coroutine with resume's status and coroutine.close.
06Metatables6 lessons, 3 to 4 hours

Lessons

  • Metatables and __index for defaults and fallbacks
  • __newindex, rawset and guarded tables
  • Operator metamethods: __add, __eq, __lt, __concat, __len and __call
  • Classes with setmetatable and method call syntax
  • Inheritance, super calls and method resolution
  • Metatable guards, __metatable and to-be-closed values

After this module you can

  • Attach a metatable with setmetatable and use an __index table or function to supply missing fields, distinguishing raw access with rawget.
  • Intercept assignments with __newindex, write through to a backing table with rawset and build a read-only table that raises an error on writes.
  • Protect a metatable with the __metatable field and release a resource deterministically with a local <close> variable and its __close metamethod.
07Modules5 lessons, 2 to 4 hours

Lessons

  • require, package.loaded and run-once caching
  • Writing a module table with private and public members
  • package.path, search order and project layout
  • package.preload, testing doubles and circular requires
  • Designing a small stable module interface and version guard

After this module you can

  • Load a module with require, explain that its chunk runs once and that later calls return the cached value from package.loaded.
  • Write a module file that exposes a public function table, keeps helpers local, avoids creating globals and returns the table.
  • Define a module API with documented functions, a version field and a startup guard against an unsupported Lua version.
08Errors and IO7 lessons, 3 to 5 hours

Lessons

  • Raising errors with error and catching them with pcall
  • Message handlers with xpcall and tracebacks
  • Error values, assert and the nil-plus-message convention
  • Reading standard input with io.read and io.lines
  • Opening, reading and writing files
  • Standard error, environment, time and exit status
  • Saving and loading structured data in a text file

After this module you can

  • Raise an error with a string or table value, catch it with pcall, read the status and error object, and use the level argument of error.
  • Use xpcall with a message handler to add context to an error before the stack unwinds and explain when the handler is not called.
  • Write a table of records to a line-based text file using string.format and read it back with patterns, preserving values that contain special characters.
09Testing and application project6 lessons, 3 to 4 hours

Lessons

  • Plain assertion tests and a test runner script
  • Testing with busted: describe, it and assertions
  • Table-driven tests, boundaries and error cases
  • Parsing command-line flags and subcommands
  • Layered configuration: defaults, file and command-line overrides
  • Assembling, testing and demonstrating the utility

After this module you can

  • Write a test file of named checks with assert, count passes and failures with pcall and exit non-zero when any check fails.
  • Write a busted spec file with describe, it, before_each and the assert.are.equal, assert.are.same, assert.is_true and assert.has_error assertions and run it with the busted command.
  • Assemble the modules, configuration, persistence and tests into one runnable utility with a README, a launcher, a test command and recorded evidence of normal, boundary and error runs.

What you'll build

3 guided projects along the way, then a final project.

  • Text and data toolkit

    after module 3
  • Reusable function and object library

    after module 6
  • Persistent record store with error handling

    after module 8

Final project

Lua configurable command-line utility with tests and persistence. Choose one option: Task tracker command-line tool; Expense ledger command-line tool; Log summariser command-line tool.

What you submit

Source submission as a folder with bin, lib, tests and README (setup and run instructions for the pinned interpreter). Functional checks: scripted scenarios for normal, boundary and error runs with stdout, stderr and exit status transcripts.

How it's reviewed

Trainer review against the rubric: Correctness on normal, boundary and error inputs (30%) Persistence and restart behaviour (20%) Code structure, modules and interface clarity (20%) Tests that would catch a seeded mutation (20%).

Where you'll use it

  • Write a small script that summarises a log file and sets an exit status another tool can check.
  • Split a growing script into modules with a documented interface so a colleague can reuse it.

Roles that use these skills

  • Scripting developer
  • Tools programmer
  • Automation engineer

Earn the certificate by building, not watching

  1. Complete the lessons and pass each module checkpoint.
  2. Build your final project and demonstrate it.
  3. OUTLEARN reviews your project and issues your certificate. It is not issued automatically.

Frequently asked questions

What do I need before I start?

Prerequisite courses: Programming Problem Solving. Prerequisite course Programming Problem Solving, or equivalent: you can trace a loop by hand, read pseudocode and break a task into steps. Diagnostic check: given a short pseudocode for finding the largest number in a list, predict its result for [3, 9, 4] and for an empty list. You also need to open a terminal, change folder and run a program from the command line; this is taught at the start of module 1 only as it applies to the lua command. No prior Lua is assumed.

Do I get a certificate?

We do not issue certificates until you successfully build and demonstrate your live project. Module and final assessments are planned; the module pass rule is proposed, not final. Certificates are issued by OUTLEARN staff; nothing is issued automatically.

Be first in when Lua Programming opens

Email us and we will tell you as soon as enrolment opens.

Notify me when it opens
₹39Opens soon
Notify me