Kotlin for Luau Developers
Move from Luau to Kotlin through null safety, collection ownership, functions, properties and object contracts. Compare typed tables, closures and method calls, build an order processor, and port a stock ledger.
Luau and Kotlin side by side
The same program in Luau and in Kotlin, from the lessons of this course.
Strings and Templates
Luau backtick strings interpolate brace-enclosed expressions, while Kotlin templates use dollar-prefixed names or braced expressions inside double quotes. Luau print separates multiple arguments with tabs, so assemble exact text deliberately. Luau strings…
Luau1local name="Ada"; print("Hi "..name.."!")Kotlin1fun main(){2val ready=33println("Ready: $ready")4}Equality and Identity
Luau strings compare their byte contents, while table equality normally compares identity unless a metamethod applies. Kotlin == invokes null-safe equals and === tests identity. Strings have content equality, but ordinary classes do not automatically compare…
Luau1local a="ab"; local b="a".."b"; print(a==b)Kotlin1fun main(){2val a=String(charArrayOf('t','e','a'))3val b=String(charArrayOf('t','e','a'))4println(a==b)5}Arrays and IntArray
Luau sequences are tables rather than fixed-size typed arrays, and # does not count arbitrary sparse keys reliably. Kotlin arrays have fixed size, checked zero-based indexes and declared element types. IntArray provides primitive integer storage on the JVM.…
Luau1local values:{number}={2,4,6}; print(values[#values])Kotlin1fun main(){2val a=intArrayOf(4,8,12)3println(a.last())4}While, Break, and Continue
Luau and Kotlin both support continue to skip the rest of an iteration and break to exit a loop. Kotlin conditions require Boolean rather than Luau’s nil/false truthiness rule. Ensure manual indexes advance along continuing paths and test stop markers before…
Luau1local n:number=3; while n>1 do n-=1 end; print(n)Kotlin1fun main(){2val kept=mutableListOf<String>()3for(word in listOf("tea","","STOP","coffee")){if(word=="STOP")break;if(word.isEmpty())continue;kept.add(word)}4println(kept.joinToString(","))5}Top-level Functions
Luau functions may annotate argument types and multiple result packs, but those annotations serve static analysis. Kotlin functions have statically checked parameters and one result, which can be a pair or model grouping several values. Top-level helpers need…
Luau1local function hours(total:number):number return total//60 end; print(hours(125))Kotlin1fun isLong(text:String):Boolean = text.length>42fun main(){3println(isLong("coffee"))4}Input and String Formatting
Luau host APIs determine console access; the supplied runner provides io.read and io.lines extensions. Kotlin tasks provide a locked line-reading driver, with readlnOrNull representing EOF as null. toInt requires complete valid numeric text. Trim only as…
Luau1local cents=305; print(string.format("tea: %d.%02d",cents//100,cents%100))Kotlin1fun main(){2println(" tea ".trim().uppercase(java.util.Locale.ROOT))3}
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsStarting Kotlin
6 lessonsValues and Decisions
5 lessonsCollections and Ownership
5 lessonsIteration and Transformations
5 lessonsFunctions and Callbacks
5 lessonsInput, Errors, and Files
5 lessonsClasses and State
6 lessonsComposition and Value Types
5 lessonsProject: Order Processing
4 lessonsFinal Challenges
2 lessonsFrequently asked questions
Who is Kotlin for Luau Developers for?
For people who already write Luau and want to learn Kotlin. Each lesson starts from Luau you know and shows how Kotlin does the same thing, so you skip the beginner basics.
Do I need to know Kotlin already?
No. The course starts with your first Kotlin program. You need Luau basics: variables, conditions, loops, functions and collections.
How many lessons does Kotlin for Luau Developers have?
Kotlin for Luau Developers contains 48 interactive lessons you can complete at your own pace.
What does Kotlin for Luau Developers cover?
The course is organized into chapters covering: Starting Kotlin, Values and Decisions, Collections and Ownership, Iteration and Transformations, and more.
Is Kotlin 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.