Luau for Lua Developers
A focused bridge from Lua to general Luau: gradual annotations, optional types, generics, new control-flow syntax, table helpers and CLI modules. Revisit object ownership, build a stock ledger and port Lua programs.
Lua and Luau side by side
The same program in Lua and in Luau, from the lessons of this course.
Names and Local Scope
Lua 5.1 local scope transfers directly. Luau adds optional annotations after local names; they do not change scope or turn globals into locals. Treat --!strict as a request to analysis tooling, not a runtime switch.
Lua1local x = 42do local x = 9 end3print(x)Luau1local x: number = 42do local x: number = 9 end3print(x)Optional Values and Fields
Lua table deletion by nil is unchanged. Luau optional types let you describe absence, but do not introduce a new runtime null value. A nil-valued field is still absent.
Lua1local d = {x = nil}2print(d.x == nil)Luau1local d = {x = nil}2print(d.x == nil)Inclusive Loops and Updates
Inclusive Lua numeric loops transfer directly. Luau += makes accumulator updates shorter, while remaining a statement. There is no need to relearn numeric loop bounds.
Lua1local total = 02for i = 1, 3 do total = total + i end3print(total)Luau1local total = 02for i = 1, 3 do total = total + i end3print(total)Functions and Returns
Lua functions remain first-class values in Luau. Optional parameter/result annotations describe intended types, but runtime arity adjustment is still Lua-like; Coddy Run does not reject static type mismatches.
Lua1local function twice(x) return x * 2 end2print(twice(4))Luau1local function twice(x: number): number return x * 2 end2print(twice(4))Lists as Dense Tables
The Lua dense-sequence convention remains important. Luau {number} is a static sequence description, not a separate runtime array class and not a guarantee against holes from unchecked code.
Lua1local a = {"a", "b", "c"}2table.remove(a, 2)3print(table.concat(a, ","))Luau1local a = {"a", "b", "c"}2table.remove(a, 2)3print(table.concat(a, ","))Imports to require
Lua 5.1 require commonly uses package.searchers or package.loaders and module names. This Luau CLI uses relative file requests; do not port package configuration or expect unrestricted file IO. Coddy adds stdin APIs separately.
Lua1local first=require("math")2local again=require("math")3print(first == again)Luau1local first=require("./sample")2local again=require("./sample")3print(first == again)
Syllabus
10 chapters35 lessons1 project35 challenges69 quiz questionsFirst Luau Programs
3 lessonsValues and Decisions
3 lessonsIteration and Flow
2 lessonsFunctions and Closures
5 lessonsTables as Collections
4 lessonsOrdering, Modules and Errors
3 lessonsObjects and Owned State
4 lessonsComposition and Object Lookup
5 lessonsProject: Stock Ledger
4 lessonsFinal Lua Ports
2 lessonsFrequently asked questions
Who is Luau for Lua Developers for?
For people who already write Lua and want to learn Luau. Each lesson starts from Lua you know and shows how Luau does the same thing, so you skip the beginner basics.
Do I need to know Luau already?
No. The course starts with your first Luau program. You need Lua basics: variables, conditions, loops, functions and collections.
How many lessons does Luau for Lua Developers have?
Luau for Lua Developers contains 35 interactive lessons you can complete at your own pace.
What does Luau for Lua Developers cover?
The course is organized into chapters covering: First Luau Programs, Values and Decisions, Iteration and Flow, Functions and Closures, and more.
Is Luau for Lua Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.