Volt

iswritable

Checks if a table is writable (not read-only).

Syntax

iswritable(table: table) -> boolean

Parameters

ParameterTypeDescription
tabletableThe table to check

Returns

TypeDescription
booleanTrue if the table can be modified

Description

iswritable checks whether a table can be modified. This is the inverse of isreadonly - it returns true when isreadonly would return false, and vice versa.

Example

local myTable = {value = 123}

print(iswritable(myTable)) -- true

makereadonly(myTable)
print(iswritable(myTable)) -- false

makewritable(myTable)
print(iswritable(myTable)) -- true

Metatable Example

local mt = getrawmetatable(game)

if iswritable(mt) then
    print("Metatable is writable")
else
    print("Metatable is read-only")
    makewritable(mt)
end

Notes

  • Equivalent to not isreadonly(table)
  • Useful for checking before modifications

On this page