AcediaDocumentation

hasmetatable

Checks whether a value carries a metatable.

Reads the raw metatable slot, so a __metatable field does not hide the answer the way getmetatable is hidden from it.

hasmetatable(value: any): boolean

Parameters

ParameterTypeDescription
valueanyValue to inspect.

Example

print(hasmetatable(setmetatable({}, {})), hasmetatable({}))

Example output

true false

On this page