isreadonly
Reads or sets a table read-only state.
Syntax
isreadonly(table: table) -> boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
table | table | The table value used by the call. |
Returns
| Type | Description |
|---|---|
boolean | The boolean result of the check. |
Description
isreadonly is part of the Metatables library. Metatable helpers operate below normal Lua protection: they read raw metatables, replace metamethods and inspect namecalls.
The call is a predicate: it inspects the current state and returns a boolean without modifying anything.
The aliases setreadonly(table, readonly) resolve to the same implementation.
Example
local t = {}
setreadonly(t, true)
print(isreadonly(t))
Notes
- Aliases:
setreadonly(table, readonly). - Metatable changes are applied directly to the live object.