Luau for Dart Developers
Transfer Dart null safety, collections and classes to Luau tables, closures and typed signatures. Practice runtime validation, relative modules and metatable objects, build a stock ledger and port two Dart programs.
Dart and Luau side by side
The same program in Dart and in Luau, from the lessons of this course.
Print and Comment
Dart interpolation embeds values into a string passed to print. Luau print accepts multiple arguments but separates them with tabs; concatenate with .. when one exact string is required. Luau chunks run directly without a Dart main function, and comments use…
Dart1 2void main() {3print("Hi" + ", Ada");4}Luau1local name = "Ada"2print(`Hi, {name}`)Missing Fields and Optionals
A Dart Map can retain a key mapped to null, and containsKey distinguishes that entry from absence. Luau nil removes the table association. A number? annotation describes a possible nil value but cannot retain a nil-valued key. Use a presence flag or tagged…
Dart1 2void main() {3final record=<String,int?>{"x":null}; print(record.containsKey("x"));4}Luau1local d = {x = nil}2print(d.x == nil)Inclusive Numeric Loops
Dart counted loops can use an exclusive end condition. Luau numeric for includes its final bound and accepts a step. Translate the sequence of visited values, especially descending loops and empty cases, rather than reusing an exclusive bound unchanged.
Dart1 2void main() {3var total=0; for(var i=1;i<4;i++){total+=i;} print(total);4}Luau1local total = 02for i = 1, 3 do total = total + i end3print(total)Functions and Returns
Dart function signatures describe parameter and return types, with runtime checks at relevant dynamic boundaries. Luau annotations are erased and this runner does not execute the analyzer. Rebinding a scalar parameter stays local; a table parameter can mutate…
Dart1 2void main() {3int twice(int x)=>x*2; print(twice(4));4}Luau1local function twice(x: number): number return x * 2 end2print(twice(4))Lists as Dense Tables
Dart Lists may be growable, fixed-length or unmodifiable, with zero-based removal operations. Luau dense tables conventionally start at one, and table.remove shifts later elements. Assigning nil creates a hole. Keep sequence length distinct from the number of…
Dart1 2void main() {3final values=["a","b","c"]; values.removeAt(1); print(values.join(","));4}Luau1local a = {"a", "b", "c"}2table.remove(a, 2)3print(table.concat(a, ","))Sorting and Comparators
Dart List.sort expects a comparator returning a negative, zero or positive integer. Luau table.sort expects a Boolean strict ordering predicate and mutates the table. A numeric difference is wrong because zero is truthy. Keep the original reference rather…
Dart1 2void main() {3final values=[3,1,2]; values.sort((a,b)=>a.compareTo(b)); print(values[0]);4}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 Source Ports
2 lessonsFrequently asked questions
Who is Luau for Dart Developers for?
For people who already write Dart and want to learn Luau. Each lesson starts from Dart 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 Dart basics: variables, conditions, loops, functions and collections.
How many lessons does Luau for Dart Developers have?
Luau for Dart Developers contains 48 interactive lessons you can complete at your own pace.
What does Luau for Dart 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 Dart Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.