Yuari
Documentation
Docs/Metatables/makereadonly

makereadonly

Makes a table read-only or writable.

Syntax

makereadonly(table: table) -> nil

Parameters

ParameterTypeDescription
tabletableThe table value used by the call.

Returns

TypeDescription
nilThis function does not return a value.

Description

makereadonly is part of the Metatables library. Metatable helpers operate below normal Lua protection: they read raw metatables, replace metamethods and inspect namecalls.

Each call creates or returns a fresh object or value that you can store and pass to other functions.

The aliases makewriteable(table), makewritable(table) resolve to the same implementation.

Example

local t = {}
makereadonly(t)
print(isreadonly(t))
makewriteable(t)
print(isreadonly(t))

Notes

  • Aliases: makewriteable(table), makewritable(table).
  • Metatable changes are applied directly to the live object.