Luau for GDScript Developers
Bring GDScript experience to general Luau: truth and capture rules, typed signatures, table collections, CLI modules and metatable objects. Build a stock ledger and port inventory and reservation programs.
GDScript and Luau side by side
The same program in GDScript and in Luau, from the lessons of this course.
Print and Comment
GDScript print concatenates its arguments without the same separators as Luau print. The source explicitly includes spaces and punctuation. Use a single constructed Luau string for exact output; comments change from # to --.
GDScript1extends SceneTree2func _init():3 var name = "Ada"4 print("Hi ", name, "!")5 quit()Luau1local name = "Ada"2print(`Hi, {name}`)Null and Missing Fields
A GDScript Dictionary can retain a key with null as its value. A Luau field assigned nil disappears. Port both the presence check and the value check when these are separate decisions.
GDScript1extends SceneTree2func _init():3 var data = {"seats": null}4 print(data["seats"] == null)5 print(data.has("seats"))6 quit()Luau1local d = {x = nil}2print(d.x == nil)Ranges to Inclusive Loops
GDScript for traverses iterable values and range excludes its stop value. Luau numeric for includes its limit. Translate the bound explicitly; a list of values and a numeric counter are different loop forms.
GDScript1extends SceneTree2func _init():3 var values = [2, 4]4 for value in values:5 prints(value)6 for n in range(3):7 print(n)8 quit()Luau1local total = 02for i = 1, 3 do total = total + i end3print(total)Functions and Returns
A GDScript function that mutates an Array affects the caller even if it returns no useful result. Luau table arguments also carry references. Rebinding a parameter and mutating the referred collection are distinct operations.
GDScript1extends SceneTree2func add_item(items):3 items.append(9)4func _init():5 var items = [1]6 add_item(items)7 print(items.size())8 quit()Luau1local function twice(x: number): number return x * 2 end2print(twice(4))Lists as Dense Tables
GDScript Array uses zero-based indexes and append. Luau sequences are dense one-based tables with table.insert. A typed sequence description does not make those indexing conventions interchangeable.
GDScript1extends SceneTree2func _init():3 var items = [4, 8]4 items.append(12)5 print(items[-1])6 quit()Luau1local a = {"a", "b", "c"}2table.remove(a, 2)3print(table.concat(a, ","))Sorting and Comparators
GDScript sort_custom accepts a Boolean ordering callback. Luau table.sort also needs a strict Boolean comparator. Keep equal-primary-key tie handling explicit so output order does not depend on unspecified stability.
GDScript1extends SceneTree2func _init():3 var words = ["pear", "fig", "plum"]4 var kept = words.filter(func(w): return w.length() >= 4)5 kept.sort()6 print(" ".join(kept))7 quit()Luau1local a={3,1,2}2table.sort(a)3print(a[1])
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsFirst Luau Programs
6 lessonsValues and Decisions
5 lessonsIteration and Flow
5 lessonsFunctions and Closures
5 lessonsTables as Collections
5 lessonsOrdering, Modules and Errors
5 lessonsObjects and Owned State
5 lessonsComposition and Object Lookup
6 lessonsProject: Stock Ledger
4 lessonsFinal GDScript Ports
2 lessonsFrequently asked questions
Who is Luau for GDScript Developers for?
For people who already write GDScript and want to learn Luau. Each lesson starts from GDScript 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 GDScript basics: variables, conditions, loops, functions and collections.
How many lessons does Luau for GDScript Developers have?
Luau for GDScript Developers contains 48 interactive lessons you can complete at your own pace.
What does Luau for GDScript 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 GDScript Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.