Metatable
The Metatable library enables advanced interaction with metatables in Luau. It provides direct access to core metamethods and internal table behaviours - including those normally protected or hidden via __metatable
locks.
This library is especially useful when trying to modify or access hidden things within locked Roblox objects.
What is a metatable?
A metatable in Luau is a hidden table that can change the behavior of another table. Metatables allow you to define custom behaviors like operator overloading, default values, or interception of table reads and writes using special fields like __index
or __newindex
.
In Roblox, this is useful for exposing metatables of Roblox Instances so that they can be leveraged for hooking or other modifications.
What can you do?
With the Metatable library, you can:
- Retrieve hidden metatables using
getrawmetatable
- Replace a table or object's metatable with
setrawmetatable
- Control whether a table is locked using
setreadonly
- Check whether a table is locked with
isreadonly