Menu
CoddyTech

What Is Luau?

Part of the Introduction To Luau section of Coddy's Lua journey. Lesson 1 of 80.

Luau is a programming language created at Roblox that builds on the Lua you already know by adding gradual static types. Think of it as Lua with an extra layer of safety and tooling. It powers millions of Roblox experiences and has been open source since 2021.

The key idea is that Luau is a superset of Lua 5.1. Any valid Lua 5.1 code is also valid Luau code: you can take a script you wrote in the previous sections and run it as Luau, unchanged.

What Luau adds on top is type annotations. An annotation declares what kind of data a variable should hold, a string, a number, a boolean, a table, so mistakes can be caught before your code even runs:

-- Lua (also valid Luau)
local playerName = "Rio"

-- Luau with a type annotation
local playerName: string = "Rio"

The word gradual matters: annotations are optional. You can type one variable, one function, or a whole file: untyped Lua-style code keeps working while you add types at your own pace.

In return you get better editor tooling, more readable code, and protection against the kind of bugs that plain Lua only reveals while the program is running.

challenge icon

Challenge

Easy

Turn this Lua variable into a typed Luau variable.

  1. On the line local message = "Hello World", add : string right after message.
  2. Keep the print(message) line as it is.

Press Run Code: the output shows Hello World.

Try it yourself

-- Plain Lua: message has no type yet
local message = "Hello World"
print(message)

All lessons in Introduction To Luau

Practice on your own: Online Luau compiler