Syntax
hasmetatable(target: any): booleanArguments
| Name | Type | Description |
|---|---|---|
target | any | Target function, table, stack level, or object being inspected or changed. |
Returns
| Name | Type | Description |
|---|---|---|
hasMetatable | boolean | True when the target has a metatable. |
Description
Checks whether a target value has a metatable.
Call it with 1 parameter(s): target. The argument table explains which values are required and which ones only refine the behavior.
It returns hasMetatable (boolean). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Example call with placeholder values.
local result = hasmetatable(nil)
print(result)