GDScript for Luau Developers
Move from Luau tables and metatables to GDScript scripts, typed containers, objects, signals and explicit failure contracts. Build a stock depot through 48 multi-file console lessons.
Luau and GDScript side by side
The same program in Luau and in GDScript, from the lessons of this course.
Text and Comments
Luau executes top-level statements and uses -- for comments. GDScript statements run inside functions; the supplied Node enters _ready. GDScript uses # for comments, while a quoted # remains data. Luau print separates arguments with tabs in this CLI; GDScript…
Luau1-- A comment does not print.2print("tag", 7)3print("# data")GDScript1extends Node2 3func _ready() -> void:4 print("tag", 7)5 print("# data")Branches and Values
Luau closes statement branches with end and spells a chained branch elseif. GDScript uses indentation, colons and elif. Luau also supports an if expression with then and else; GDScript puts the true value before if. Prefer these explicit expressions to the…
Luau1local n = -32local label = if n < 0 then "west" else "east"3print(label)GDScript1extends Node2 3func _ready() -> void:4 var n: int = -25 print("west" if n < 0 else "east")Array Operations
Luau uses the sequence portion of a table for array-like data, conventionally indexed from one. GDScript Array is a separate container indexed from zero and supports negative indices from the end. A Luau negative table key is an ordinary key, not a…
Luau1local items = {3}2table.insert(items, 8)3local last = table.remove(items)4print(string.format("%d %d", last, #items))5print(items[-1] == nil)GDScript1extends Node2 3func _ready() -> void:4 var items: Array = [3]5 items.append(8)6 var removed = items.pop_back()7 print("%d %d" % [removed,items.size()])String Operations
Luau strings are immutable byte sequences; .. concatenates them. GDScript String has text value semantics and uses + for concatenation. In both examples a replacement creates new text rather than mutating the original binding. Luau string.gsub uses patterns…
Luau1local s = "a-b-a"2local t, count = string.gsub(s, "-", "/")3print(s .. " " .. t)4print(count)GDScript1extends Node2 3func _ready() -> void:4 var s: String = "a-b-a"5 var t: String = s.replace("-","/")6 print(s," ",t)Scripts as Classes
Luau has no native class declaration: tables hold state and metatables can supply shared methods through __index. A type alias describes a shape for analysis, not a runtime constructor. GDScript makes each script a class; class_name registers its name…
Luau1local Token = {}2export type Token = {text: string}3function Token.new(): Token4 return {text = "blue"}5end6return TokenGDScript1class_name DemoToken2extends RefCounted3var text: String = "blue"Inheritance and Super
Luau can build prototype lookup chains with metatables, but it has no extends or super keywords. Calling a base implementation means explicitly selecting its function and supplying the receiver. GDScript has one base class per script, supports overrides, and…
Luau1local Base = {}2function Base:label(): string3 return "base"4end5return BaseGDScript1class_name DemoBase2extends RefCounted3func label() -> String:4 return "base"
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsScripts and Scalar Values
6 lessonsFlow and Functions
6 lessonsCollection Ownership
6 lessonsText and Callable Values
3 lessonsObjects and State
5 lessonsObject Relationships
5 lessonsEvents and Failure
5 lessonsBoundaries and Lifetimes
6 lessonsConnected Stock Depot
Project4 lessonsFinal Ports
2 lessonsFrequently asked questions
Who is GDScript for Luau Developers for?
For people who already write Luau and want to learn GDScript. Each lesson starts from Luau you know and shows how GDScript does the same thing, so you skip the beginner basics.
Do I need to know GDScript already?
No. The course starts with your first GDScript program. You need Luau basics: variables, conditions, loops, functions and collections.
How many lessons does GDScript for Luau Developers have?
GDScript for Luau Developers contains 48 interactive lessons you can complete at your own pace.
What does GDScript for Luau Developers cover?
The course is organized into chapters covering: Scripts and Scalar Values, Flow and Functions, Collection Ownership, Text and Callable Values, and more.
Is GDScript 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.