Menu
CoddyTech
Course

Luau for Go Developers

Transfer Go slices, maps, closures and interfaces to Luau tables and typed signatures. Practice runtime validation, relative modules and metatable objects, build a stock ledger and port two Go programs.

Go and Luau side by side

The same program in Go and in Luau, from the lessons of this course.

  1. Print and Comment

    Go fmt functions distinguish formatted output from space-separated printing. Luau print inserts tabs between arguments and a final newline. Build one exact string with .. or string.format when needed. Luau chunks run directly without package main or a main…

    Go
    1package main2import ("fmt")3
    4func main(){5fmt.Println("Hi"+", Ada")6}
    Luau
    1local name = "Ada"2print(`Hi, {name}`)
  2. Missing Fields and Optionals

    Go map lookup returns a zero value and an optional presence flag, so a stored zero or nil can be distinguished from absence. Luau missing fields return nil, and assigning nil removes the key. Use a tagged record or flag when an explicit empty value must…

    Go
    1package main2import ("fmt")3
    4func main(){5values:=map[string]*int{"x":nil}; _,ok:=values["x"]; fmt.Println(ok)6}
    Luau
    1local d = {x = nil}2print(d.x == nil)
  3. Inclusive Numeric Loops

    Go for loops can use an exclusive upper bound. Luau numeric for includes its final bound and takes an optional step. Translate the actual visited values, including descending and empty cases, rather than copying the source limit unchanged.

    Go
    1package main2import ("fmt")3
    4func main(){5total:=0; for i:=1;i<4;i++ {total+=i}; fmt.Println(total)6}
    Luau
    1local total = 02for i = 1, 3 do total = total + i end3print(total)
  4. Functions and Returns

    Go passes arguments by value; pointers can expose caller-owned storage, while maps and slices carry references to underlying data. Luau scalar rebinding remains local and table fields can mutate shared state. Typed signatures describe intent, but this runner…

    Go
    1package main2import ("fmt")3func twice(n int) int {return n*2}4func main(){5fmt.Println(twice(4))6}
    Luau
    1local function twice(x: number): number return x * 2 end2print(twice(4))
  5. Lists as Dense Tables

    Go slices carry length and capacity and can share a backing array after slicing or assignment. Luau dense tables use one-based keys and table.remove shifts later elements. Setting a slot to nil leaves a hole. Do not translate a slice header copy into an…

    Go
    1package main2import ("fmt"; "strings")3
    4func main(){5a:=[]string{"a","b","c"}; a=append(a[:1],a[2:]...); fmt.Println(strings.Join(a,","))6}
    Luau
    1local a = {"a", "b", "c"}2table.remove(a, 2)3print(table.concat(a, ","))
  6. Sorting and Comparators

    Go sorting APIs can use a Boolean less function or a three-way comparator, depending on the API. Luau table.sort requires a Boolean strict-order predicate and mutates the sequence. Returning a numeric difference fails because zero is truthy. Retain the…

    Go
    1package main2import ("fmt"; "sort")3
    4func main(){5a:=[]int{3,1,2}; sort.Slice(a,func(i,j int)bool{return a[i]<a[j]}); fmt.Println(a[0])6}
    Luau
    1local a={3,1,2}2table.sort(a)3print(a[1])

Syllabus

10 chapters48 lessons1 project48 challenges99 quiz questions

Final Source Ports

2 lessons

More courses for Go developers

Learn Luau from another language

Frequently asked questions

Who is Luau for Go Developers for?

For people who already write Go and want to learn Luau. Each lesson starts from Go 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 Go basics: variables, conditions, loops, functions and collections.

How many lessons does Luau for Go Developers have?

Luau for Go Developers contains 48 interactive lessons you can complete at your own pace.

What does Luau for Go 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 Go 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 Luau for Go Developers for free

Get started