isfrozen()
Published Oct 5, 2023
Contribute to Docs
The isfrozen()
function in the Luau programming language returns a boolean based on whether the table is in read-only mode or not. When a table is in read-only mode, it means that the contents can’t be modified, as a measure of data protection.
Syntax
isfrozen(table);
The isfrozen()
function returns a boolean value, true
if the table is in read-only mode and false
if it’s not.
Example
In this example, a table called myTable
is created. Then, the isfrozen()
function is used to check if it’s in read-only mode.
-- Create a tablelocal myTable = {1, 2, 3}-- Check if the table is initially frozen (read-only)local frozenStatus = table.isfrozen(myTable)-- Output the resultif frozenStatus thenprint("The table is frozen (read-only).")elseprint("The table is not frozen (read/write).")end
The code above will result in the following output:
The table is not frozen (read/write).
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.