Menu
CoddyTech
Course

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.

  1. 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…

    Luau
    1-- A comment does not print.2print("tag", 7)3print("# data")
    GDScript
    1extends Node2
    3func _ready() -> void:4	print("tag", 7)5	print("# data")
  2. 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…

    Luau
    1local n = -32local label = if n < 0 then "west" else "east"3print(label)
    GDScript
    1extends Node2
    3func _ready() -> void:4	var n: int = -25	print("west" if n < 0 else "east")
  3. 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…

    Luau
    1local items = {3}2table.insert(items, 8)3local last = table.remove(items)4print(string.format("%d %d", last, #items))5print(items[-1] == nil)
    GDScript
    1extends 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()])
  4. 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…

    Luau
    1local s = "a-b-a"2local t, count = string.gsub(s, "-", "/")3print(s .. " " .. t)4print(count)
    GDScript
    1extends Node2
    3func _ready() -> void:4	var s: String = "a-b-a"5	var t: String = s.replace("-","/")6	print(s," ",t)
  5. 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…

    Luau
    1local Token = {}2export type Token = {text: string}3function Token.new(): Token4    return {text = "blue"}5end6return Token
    GDScript
    1class_name DemoToken2extends RefCounted3var text: String = "blue"
  6. 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…

    Luau
    1local Base = {}2function Base:label(): string3    return "base"4end5return Base
    GDScript
    1class_name DemoBase2extends RefCounted3func label() -> String:4	return "base"

Syllabus

10 chapters48 lessons1 project48 challenges99 quiz questions

More courses for Luau developers

Learn GDScript from another language

Frequently 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.

Coddy programming languages illustration

Start GDScript for Luau Developers for free

Get started