Sets the raw metatable of object, even when __metatable is set to lock it.
If object’s current metatable has __metatable set, setmetatable errors out.
setrawmetatable skips that lock and writes the metatable directly. Pass nil for metatable to clear object’s metatable instead.
Most commonly used to replace the metatable of an Instance whose __metatable field would otherwise block a normal setmetatable call.
Parameters
Returns
any - the same object passed in, by reference. Useful for chaining: local t = setrawmetatable({}, mt).
Example
Bypasses standard Lua restriction checks.