Menu
CoddyTech
Course

Luau for Lua Developers

A focused bridge from Lua to general Luau: gradual annotations, optional types, generics, new control-flow syntax, table helpers and CLI modules. Revisit object ownership, build a stock ledger and port Lua programs.

Lua and Luau side by side

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

  1. Names and Local Scope

    Lua 5.1 local scope transfers directly. Luau adds optional annotations after local names; they do not change scope or turn globals into locals. Treat --!strict as a request to analysis tooling, not a runtime switch.

    Lua
    1local x = 42do local x = 9 end3print(x)
    Luau
    1local x: number = 42do local x: number = 9 end3print(x)
  2. Optional Values and Fields

    Lua table deletion by nil is unchanged. Luau optional types let you describe absence, but do not introduce a new runtime null value. A nil-valued field is still absent.

    Lua
    1local d = {x = nil}2print(d.x == nil)
    Luau
    1local d = {x = nil}2print(d.x == nil)
  3. Inclusive Loops and Updates

    Inclusive Lua numeric loops transfer directly. Luau += makes accumulator updates shorter, while remaining a statement. There is no need to relearn numeric loop bounds.

    Lua
    1local total = 02for i = 1, 3 do total = total + i end3print(total)
    Luau
    1local total = 02for i = 1, 3 do total = total + i end3print(total)
  4. Functions and Returns

    Lua functions remain first-class values in Luau. Optional parameter/result annotations describe intended types, but runtime arity adjustment is still Lua-like; Coddy Run does not reject static type mismatches.

    Lua
    1local function twice(x) return x * 2 end2print(twice(4))
    Luau
    1local function twice(x: number): number return x * 2 end2print(twice(4))
  5. Lists as Dense Tables

    The Lua dense-sequence convention remains important. Luau {number} is a static sequence description, not a separate runtime array class and not a guarantee against holes from unchecked code.

    Lua
    1local a = {"a", "b", "c"}2table.remove(a, 2)3print(table.concat(a, ","))
    Luau
    1local a = {"a", "b", "c"}2table.remove(a, 2)3print(table.concat(a, ","))
  6. Imports to require

    Lua 5.1 require commonly uses package.searchers or package.loaders and module names. This Luau CLI uses relative file requests; do not port package configuration or expect unrestricted file IO. Coddy adds stdin APIs separately.

    Lua
    1local first=require("math")2local again=require("math")3print(first == again)
    Luau
    1local first=require("./sample")2local again=require("./sample")3print(first == again)

Syllabus

10 chapters35 lessons1 project35 challenges69 quiz questions

More courses for Lua developers

Learn Luau from another language

Frequently asked questions

Who is Luau for Lua Developers for?

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

How many lessons does Luau for Lua Developers have?

Luau for Lua Developers contains 35 interactive lessons you can complete at your own pace.

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

Get started