Menu
CoddyTech
Course

Luau for Kotlin Developers

Transfer Kotlin 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 Kotlin programs.

Kotlin and Luau side by side

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

  1. Print and Comment

    Kotlin string templates assemble text before println prints it. Luau print can take several values but inserts tabs between them; use .. to assemble one exact string. Luau chunks run directly without a main function, and line comments use -- rather than…

    Kotlin
    1
    2fun main(){3println("Hi"+", Ada")4}
    Luau
    1local name = "Ada"2print(`Hi, {name}`)
  2. Missing Fields and Optionals

    A Kotlin map with nullable values can retain a key mapped to null, and containsKey distinguishes presence. Luau nil removes a table association. A number? annotation permits nil but cannot retain a nil-valued key. Use a tagged state record for…

    Kotlin
    1
    2fun main(){3val record=mapOf<String,Int?>("x" to null)4println(record.containsKey("x"))5}
    Luau
    1local d = {x = nil}2print(d.x == nil)
  3. Inclusive Numeric Loops

    Kotlin inclusive ranges and exclusive ranges express different final values, and downTo supplies descending progression. Luau numeric for uses an inclusive bound and optional step. Translate the values actually visited and preserve empty-range cases rather…

    Kotlin
    1
    2fun main(){3var total=04for(i in 1 until 4) total+=i5println(total)6}
    Luau
    1local total = 02for i = 1, 3 do total = total + i end3print(total)
  4. Functions and Returns

    Kotlin parameters have declared types and receive values, including references to objects; parameters cannot be rebound as ordinary mutable locals. Luau scalar parameters may be rebound locally and table fields may mutate shared state. Typed signatures do not…

    Kotlin
    1fun twice(n:Int)=n*22fun main(){3println(twice(4))4}
    Luau
    1local function twice(x: number): number return x * 2 end2print(twice(4))
  5. Lists as Dense Tables

    Kotlin separates read-only and mutable collection interfaces, but a read-only view does not necessarily mean immutable underlying storage. Luau dense tables use one-based keys and table.remove shifts later elements. Assigning nil creates a hole. A type…

    Kotlin
    1
    2fun main(){3val values=mutableListOf("a","b","c")4values.removeAt(1)5println(values.joinToString(","))6}
    Luau
    1local a = {"a", "b", "c"}2table.remove(a, 2)3print(table.concat(a, ","))
  6. Sorting and Comparators

    Kotlin comparators return negative, zero or positive integers, while sort and sorted distinguish mutation from creating a result. Luau table.sort mutates and expects a Boolean strict-order predicate. Returning a number fails because zero is truthy. Keep the…

    Kotlin
    1
    2fun main(){3val values=mutableListOf(3,1,2)4values.sortWith(compareBy {it})5println(values[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 Kotlin developers

Learn Luau from another language

Frequently asked questions

Who is Luau for Kotlin Developers for?

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

How many lessons does Luau for Kotlin Developers have?

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

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

Get started