Debug libraryOverviewNew · 0.744
debug.setmetatable
Describe changes to a value's metatable association.
Details#
Assigns a value's metatable directly, including when ordinary metatable protection is present. A nil metatable removes it. Use a local table to keep the change scoped to the example.
Examples#
Example
local value = {}
debug.setmetatable(value, { __index = { label = "example" } })
print(value.label) -- example
debug.setmetatable(value, nil)