Metatables
hasmetafield
Returns whether the target value has a non-nil raw metafield with the requested name. The function does not call the metafield, does not invoke __index lookup, and does not change readonly state.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Returns whether the target value has a non-nil raw metafield with the requested name. The function does not call the metafield, does not invoke __index lookup, and does not change readonly state.
hasmetafield(target: any, field: string): boolean
local target = {}
local meta = {
__index = {},
}
setrawmetatable(target, meta)
print(hasmetafield(target, "__index"))
print(hasmetafield(target, "__newindex"))