Skip to content
Saiko

makereadonly

Makes a table read-only, so writing to it raises an error. The same as setreadonly(tab, true).

Signature

luau
makereadonly(tab: { any }): ()

Parameters

tab{ any }

The table to lock.

Returns

Nothing.

Note

Example

luau
local settings = { mode = "safe" }

makereadonly(settings)
print(isreadonly(settings)) --> true
print(pcall(function()
    settings.mode = "fast"
end)) --> false