iswritable
Returns true when a table is not read-only.
Syntax
iswritable(table: table) -> boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
table | table | The table value used by the call. |
Returns
| Type | Description |
|---|---|
boolean | True when a table is not read-only |
Description
iswritable 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 iswriteable(table) resolve to the same implementation.
Example
local t = {}
makereadonly(t)
print(iswritable(t)) -- false
makewriteable(t)
print(iswritable(t)) -- true
Notes
- Aliases:
iswriteable(table). - Metatable changes are applied directly to the live object.