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.



The isfrozen() function returns a boolean value, true if the table is in read-only mode and false if it’s not.


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 table
local myTable = {1, 2, 3}
-- Check if the table is initially frozen (read-only)
local frozenStatus = table.isfrozen(myTable)
-- Output the result
if frozenStatus then
print("The table is frozen (read-only).")
print("The table is not frozen (read/write).")

The code above will result in the following output:

The table is not frozen (read/write).

All contributors

Looking to contribute?

Learn Luau on Codecademy