mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 06:46:04 +01:00
enhance dosItemExist() and add getItemLabel()
This commit is contained in:
@@ -891,9 +891,28 @@ end
|
|||||||
--- if doesItemExist(item) then print("item exists") end
|
--- if doesItemExist(item) then print("item exists") end
|
||||||
--- ```
|
--- ```
|
||||||
function doesItemExist(item)
|
function doesItemExist(item)
|
||||||
if not item or item == "" then return false end
|
if not item or item == "" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if not Items or not next(Items) then
|
||||||
|
return item.." (Missing)"
|
||||||
|
end
|
||||||
if Items[item] ~= nil then
|
if Items[item] ~= nil then
|
||||||
return true
|
return Items[item]
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function getItemLabel(item)
|
||||||
|
if not item or item == "" then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
if not Items or not next(Items) then
|
||||||
|
return item.." (Missing)"
|
||||||
|
end
|
||||||
|
if Items[item] ~= nil then
|
||||||
|
return Items[item].label
|
||||||
|
end
|
||||||
|
return item.." (Missing)"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user