Luau for TypeScript Developers
Transfer TypeScript skills to general Luau: truth rules, typed signatures, runtime validation, table collections, relative modules and metatable objects. Build a stock ledger and port two source programs.
TypeScript and Luau side by side
The same program in TypeScript and in Luau, from the lessons of this course.
Print and Comment
JavaScript uses + and template literals; Luau uses .. and backtick interpolation with braces instead of dollar-braces. console.log is a host API, while print is the Luau output function. TypeScript string annotations are erased; changing the annotation does…
TypeScript1const greeting: string = "Hi" + ", Ada";2console.log(greeting);Luau1local name = "Ada"2print(`Hi, {name}`)Missing Fields and Optionals
An own JavaScript property can exist with value undefined. Assigning nil removes a Luau table key. Port property-presence checks deliberately instead of translating undefined to a stored nil field. TypeScript optional properties describe possible absence. A…
TypeScript1const record: {x?: number} = {x: undefined};2console.log("x" in record);Luau1local d = {x = nil}2print(d.x == nil)Inclusive Numeric Loops
JavaScript for spells out initialization, condition and update. Luau numeric for includes its upper bound. Translate an exclusive JavaScript stop value to an inclusive Luau endpoint. Annotating the JavaScript loop counter does not alter its exclusive…
TypeScript1let total: number = 0;2for (let i: number = 1; i < 4; i++) total += i;3console.log(total);Luau1local total = 02for i = 1, 3 do total = total + i end3print(total)Functions and Returns
JavaScript functions accept omitted arguments as undefined; Luau receives nil. Both can pass functions as values. Luau additionally accepts erased signature annotations, but Run will not statically reject a wrong argument type. A TypeScript checker can reject…
TypeScript1function twice(x: number): number { return x * 2; }2console.log(twice(4));Luau1local function twice(x: number): number return x * 2 end2print(twice(4))Lists as Dense Tables
JavaScript arrays combine indexed storage, methods and a length property. Luau uses ordinary tables plus library operations. Keep sequence keys dense and do not copy zero-based array offsets. TypeScript array types do not repair sparse arrays introduced by…
TypeScript1const a: string[]=["a","b","c"];2a.splice(1,1);3console.log(a.join(","));Luau1local a = {"a", "b", "c"}2table.remove(a, 2)3print(table.concat(a, ","))Sorting and Comparators
JavaScript Array.sort comparators return a negative, zero or positive number. Luau table.sort comparators return booleans. Returning a numeric difference in Luau makes even zero truthy and breaks the ordering contract. A TypeScript comparator signature…
TypeScript1const a: number[]=[3,1,2];2a.sort((x: number,y: number): number=>x-y);3console.log(a[0]);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 TypeScript Developers for?
For people who already write TypeScript and want to learn Luau. Each lesson starts from TypeScript 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 TypeScript basics: variables, conditions, loops, functions and collections.
How many lessons does Luau for TypeScript Developers have?
Luau for TypeScript Developers contains 48 interactive lessons you can complete at your own pace.
What does Luau for TypeScript 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 TypeScript Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.