Metatables

isreadonly

Returns whether a table is readonly.

Syntax

isreadonly(target: table): boolean

Arguments

NameTypeDescription
targettableTable whose readonly status is checked.

Returns

NameTypeDescription
readOnlybooleantrue when the table is readonly; otherwise false.

Description

Returns whether a table is readonly. The argument must be a table, and the function does not change it.

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

It returns readOnly (boolean). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Read the readonly flag stored on a table.

local target = {}

print(isreadonly(target))

setreadonly(target, true)
print(isreadonly(target))

setreadonly(target, false)