debug.getmetatable Synchronous

Read an object’s raw metatable through the debug namespace. It has the same behavior as getrawmetatable, which is convenient when related inspection code already lives under debug.

Syntax
Luau
debug.getmetatable(value: any) -> Table?

Parameters

Function parameters
ParameterTypeDescription
valueanyValue to inspect.

Returns

Table?

The raw metatable, or nil.

Example

Example
Luau
local object = setmetatable({}, { __index = function() return 0 end })
print(debug.getmetatable(object).__index ~= nil) -- true
Kawaii documentation