root: Add a `has_key` and `has_button` functions.
This commit is contained in:
parent
86d8ef3142
commit
93b90026e9
|
@ -106,6 +106,14 @@ for _, type_name in ipairs { "button", "key" } do
|
||||||
table.insert(removed, value)
|
table.insert(removed, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
capi.root["has_"..type_name] = function(item)
|
||||||
|
if not item["_is_capi_"..type_name] then
|
||||||
|
item = item[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
return gtable.hasitem(capi.root["_"..prop_name](), item) ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
assert(root[prop_name])
|
assert(root[prop_name])
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue