getrawmetatable Synchronous

Read an object’s actual metatable, even when normal metatable access is protected. Use it to inspect metamethods such as __index or __tostring.

Syntax
Luau
getrawmetatable(value: any) -> Table?

Parameters

Function parameters
ParameterTypeDescription
valueanyValue whose metatable should be inspected.

Returns

Table?

The raw metatable, or nil when there is none.

Example

Example
Luau
local object = setmetatable({}, { __tostring = function() return "item" end })
local meta = getrawmetatable(object)
print(type(meta.__tostring)) -- function
Kawaii documentation