Syntax
table.freeze(config); table.isfrozen(config)Examples
Luau frozen configuration tables
Run as a standalone current Luau script, or as a Script in Roblox Studio ServerScriptService. No Roblox engine APIs are required; type-annotated syntax is not standard Lua.
local config = {speed = 12, labels = {"start"}}
table.freeze(config)
local ok = pcall(function() config.speed = 20 end)
config.labels[1] = "ready"
print(ok)
print(table.isfrozen(config))
print(config.labels[1])- Output: false, true, ready. The top-level write fails, but the nested labels table remains mutable.
Best practices
- Freeze nested configuration deliberately when needed. Do not repeatedly freeze an already frozen table without first checking isfrozen.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation