debug. setmetatable Synchronous
Set an object’s raw metatable through the debug namespace. It follows the same behavior as setrawmetatable and returns the object you supplied.
Luau
debug.setmetatable(
value: Table | userdata | string,
metatable: Table?
) -> Table | userdata | stringParameters
| Parameter | Type | Description |
|---|---|---|
value | Table | userdata | string | Table, userdata, or string to update. |
metatable | Table? | New metatable table, or nil to remove it. |
Returns
Table | userdata | stringThe original value.
Usage notes
A Roblox Instance is returned unchanged.
Example
Luau
local object = {}
debug.setmetatable(object, { __index = function() return "missing" end })
print(object.unset) -- missing