What Is Luau? Luau vs Lua Explained for Roblox Developers

Quick answer: Luau is Roblox's own programming language: a gradually typed, faster derivative of Lua 5.1 that powers every script on the platform. It is almost fully syntax-compatible with Lua, with added type checking and sandboxing.

Luau is Roblox's own programming language: a fast, gradually typed derivative of Lua 5.1 that powers every script on the platform. It keeps Lua's small syntax and dynamic feel while adding optional type annotations, a type checker with nonstrict and strict modes, sandboxing, and performance optimizations that make it significantly faster than standard Lua interpreters. If you want to script Roblox games, Luau is the language you will actually write.

Is Luau the same as Lua?

Not exactly, but close enough that Lua knowledge transfers almost entirely. Luau started as a fork of Lua 5.1 and remains syntactically compatible with it: functions, tables, closures, metatables, and control flow all work the way they do in classic Lua. Existing Lua 5.1 code generally runs under Luau without changes (Roblox provides most of the standard library itself). The differences are additions and removals around that core, described below.

So when someone asks "is luau the same as lua," the accurate answer is: Luau is a dialect of Lua. Think of it as "Lua, customized by Roblox for building large, fast, safe multiplayer experiences."

What Luau adds to Lua

Gradual typing

The headline feature is gradual typing. Types are optional: you can annotate nothing and write dynamically typed code, or annotate everything and let the analyzer catch mistakes before your game ships. Type annotations use a single colon after identifiers:

local function addCoins(player: Player, amount: number): number
	local stats = player:FindFirstChild("leaderstats")
	if not stats then
		return 0
	end
	local coins = stats:FindFirstChild("Coins")
	if coins and coins:IsA("IntValue") then
		coins.Value += amount
		return coins.Value
	end
	return 0
end

Luau also supports generic functions, union and intersection types (string | number), optionals (number?), and exported types via type statements. None of this exists in vanilla Lua 5.1.

Type checking modes

Scripts carry a type checking mode, set per module with a comment at the top of the file:

--!strict

In strict mode, calling addCoins("Bob", 10) becomes an immediate editor error instead of a runtime crash players discover mid-game.

Performance

Luau's compiler and runtime were rebuilt for speed. It uses a register-based bytecode virtual machine, aggressive inline caching, and optimizations informed by real Roblox workloads, plus a full optimizing compiler for native code generation on supported platforms. In practice, hot loops written in idiomatic Luau run several times faster than the equivalent in stock Lua 5.1 interpreters. This matters because Roblox simulations can involve thousands of parts and dozens of scripts running every frame.

Sandboxing

Roblox runs all Luau code inside a security sandbox. Scripts cannot touch the filesystem, open network sockets directly, or load arbitrary native libraries — there is no io, no os.execute, and none of the dangerous parts of the Lua standard library. Instead, Roblox exposes purpose-built APIs such as DataStoreService for persistence and HttpService for controlled web requests. The sandbox is what makes it safe to let millions of players run user-generated games.

What Luau removes or replaces

Because Roblox controls the whole runtime, some Lua 5.1 features are gone or replaced:

Everything else — tables as the universal data structure, metatables for OOP-style classes, coroutines, string patterns — behaves like Lua 5.1.

Where does Luau code run?

Every Roblox game runs two copies of the world: one simulated authoritatively on Roblox servers, and one rendered on each player's device. Luau scripts run on both sides, each in its own context:

Communication between the two sides crosses Roblox's network boundary (FilteringEnabled is always on), which is why remote events exist. If that split is new to you, the Roblox RemoteEvent guide walks through client-server messaging in detail.

A minimal server Script showing both plain and annotated styles:

local Players = game:GetService("Players")

local WELCOME_MESSAGE = "Welcome to the game!"

local function greet(playerName: string): string
	return WELCOME_MESSAGE .. " Hello, " .. playerName .. "!"
end

Players.PlayerAdded:Connect(function(player)
	print(greet(player.Name))
end)

The same file could be made strict by adding --!strict at the top, and the analyzer would then verify every call to greet across your codebase.

Do I need to learn Lua first?

No. Because Luau is a superset of Lua 5.1 syntax for practical purposes, learning Luau is learning Lua fundamentals — tables, functions, loops, conditionals — plus Roblox-specific APIs on top. Tutorials written for general Lua mostly apply; tutorials about Roblox scripting assume Luau. For a broader comparison of study paths, see what is Luau used for covered in our guide to the best ways to learn, and if you are brand new, start with our Roblox scripting for beginners guide. Once comfortable with classes, our guide on setmetatable and OOP shows how Lua-style object orientation carries over unchanged.

Learn Luau by doing

Reading about Luau only gets you so far — the language clicks fastest when you write and run it yourself. Luablox lets you practice Luau free in your browser with interactive theory lessons, hands-on coding problems, and guided lessons that take you from first variable to working game systems, no installs required.

Frequently asked questions

Is Luau the same as Lua?

Luau is a derivative of Lua 5.1, so almost all Lua syntax works identically. However, Luau adds gradual type annotations, a type checker with nonstrict and strict modes, performance optimizations, and sandboxing, while removing unsafe parts of the standard library like io and os.

Is Luau only used in Roblox?

Luau was created by Roblox and is the official scripting language of the Roblox platform. It is open source and has been adopted by a few other projects, but Roblox is by far where it is used in practice.

Do I need to learn Lua before Luau?

No. Since Luau keeps Lua 5.1 syntax, learning Luau teaches you Lua fundamentals automatically. Most general Lua tutorials still apply; you simply skip the standard-library features Roblox removes, like file I/O.

Does Luau require type annotations?

No. Typing is gradual: annotations are optional, and unannotated code runs normally. You can opt into stronger checking per script with the --!strict comment, which makes the analyzer flag type errors before your game runs.

Where does Luau code run in Roblox?

Server Scripts run on Roblox servers and own trusted game logic. LocalScripts run on each player's device and handle input, UI, and camera. ModuleScripts hold shared code loaded by either side.

Learn core Roblox scripting and Luau programming concepts, including: what is luau, luau vs lua, is luau the same as lua, luau programming language, roblox scripting language.

Related pages