hasmetatable Synchronous
Check whether a value has any metatable at all. This is a quick guard before reading or changing metamethods.
Luau
hasmetatable(value: any) -> booleanParameters
| Parameter | Type | Description |
|---|---|---|
value | any | Value to inspect. |
Returns
booleantrue if a raw metatable exists.
Example
Luau
local object = setmetatable({}, {})
print(hasmetatable(object)) -- true
print(hasmetatable({})) -- false