Metatables

makereadonly

Marks a table as readonly and returns no values.

Syntax

makereadonly(target: table)

Arguments

NameTypeDescription
targettableTable to mark as readonly.

Description

Marks a table as readonly and returns no values.

Call it with 1 parameter(s): target. The argument table explains which values are required and which ones only refine the behavior.

It does not return data. Treat the call as an action and handle errors around the call site when needed.

Example

Set a table's readonly flag to true.

local target = {}

makereadonly(target)

print(isreadonly(target))