Lua for Luau Developers
Port standalone Luau programs to Lua 5.1: replace syntax extensions, adapt libraries and modules, preserve table and object contracts, and finish a stock ledger plus two practical ports.
Luau and Lua side by side
The same program in Luau and in Lua, from the lessons of this course.
Interpolation to Text
Luau backtick strings can evaluate expressions inside braces. Lua 5.1 does not parse that syntax. Build the same text with .. or string.format. The familiar quoted strings, long strings and -- comments still work. Both runtimes separate multiple arguments to…
Luau1local name = "Ada"2print(`Hi, {name}!`)Lua1local name = "Ada"2print("Hi, " .. name .. "!")Generalized Iteration
Luau permits a table directly after in in a generic loop. Lua 5.1 requires an iterator function plus its state and control value; ipairs and pairs provide those values. Choose deliberately. For a dense one-based sequence, ipairs yields consecutive integer…
Luau1local rows: {string} = {"a", "b"}2for i, value in rows do print(`{i}:{value}`) endLua1for i, value in ipairs({"a", "b"}) do print(i .. ":" .. value) endTable Library Porting
Luau offers table.create to allocate and optionally fill an array. Lua 5.1 needs a constructor or an explicit fill loop. Keep allocation and length separate: an array filled with a value has entries, while reserved capacity alone is not a sequence of that…
Luau1local items = table.create(3, "x")2print(table.concat(items, ","))Lua1local items = {}2for i = 1, 3 do items[i] = "x" end3print(table.concat(items, ","))Types and Runtime Objects
A Luau record type is not a constructor. Runtime instances still need fresh tables, whether the source uses structural types or metatable-based methods. Lua 5.1 removes the type declaration but keeps that allocation responsibility. The constructor in the task…
Luau1type Counter = {n: number}2local function new(n: number): Counter return {n=n} end3local a, b = new(2), new(7)4a.n += 15print(`{a.n}:{b.n}`)Lua1local Model = {}2Model.__index = Model3function Model.new(n) return setmetatable({n=n}, Model) end4local a,b = Model.new(2),Model.new(7)5a.n = a.n + 16print(a.n .. ":" .. b.n)
Syllabus
6 chapters29 lessons1 project29 challenges60 quiz questionsSyntax and Runtime
6 lessonsFlow and Functions
4 lessonsCollections and Libraries
6 lessonsObjects and Contracts
7 lessonsProject: Stock Ledger
4 lessonsFinal Luau Ports
2 lessonsFrequently asked questions
Who is Lua for Luau Developers for?
For people who already write Luau and want to learn Lua. Each lesson starts from Luau you know and shows how Lua does the same thing, so you skip the beginner basics.
Do I need to know Lua already?
No. The course starts with your first Lua program. You need Luau basics: variables, conditions, loops, functions and collections.
How many lessons does Lua for Luau Developers have?
Lua for Luau Developers contains 29 interactive lessons you can complete at your own pace.
What does Lua for Luau Developers cover?
The course is organized into chapters covering: Syntax and Runtime, Flow and Functions, Collections and Libraries, Objects and Contracts, and more.
Is Lua for Luau Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.