setrawmetatable
Replaces an object's metatable regardless of __metatable protection.
Signature
setrawmetatable<T>(object: T, metatable: { [any]: any }?): TParameters
objecttable | InstanceThe object to modify.
metatabletable?The metatable to install, or nil to clear it.
Returns
table
Example
local object = {}
setrawmetatable(object, {
__index = function(_, key)
return "no " .. key
end,
})
print(object.anything) --> no anything