Skip to content
Debug libraryOverviewNew · 0.744

debug.getmetatable

Describe metatable information associated with a value.

Details#

Returns the actual metatable of a value, or nil when none exists. It can expose a table hidden by the ordinary __metatable protection field; the returned table is a live reference.

Examples#

Example

Luau
local value = setmetatable({}, { __metatable = "locked", label = "example" })
print(debug.getmetatable(value).label) -- example