function private.matchDB(text)
local itemID
for itemKey, data in pairs(BeanCounterDB.ItemIDArray) do
local _, name = strsplit(";", data)
if text:find(name, 1, true) then
itemID = string.split(":", itemKey)
--debugPrint("Searching",key,"for",text,"Sucess: link is",itemLink)
local itemLink = lib.API.createItemLinkFromArray(itemKey)
return itemID, itemLink
end
end
debugPrint("Searching DB for ItemID..", key, text, "Failed Item does not exist in the name array")
return nil
end
We still used a find that was no longer needed since we dont store full itemlinks. This could return the wrong item if its name was a subsection of teh longer string we were looking for.
ie "Healing Potion" would be returned when we looked for "Greater Healing Potion"
changed to a direct string comparison
function private.matchDB(text)
local itemID
for itemKey, data in pairs(BeanCounterDB.ItemIDArray) do
local _, name = strsplit(";", data)
if text == name then
itemID = string.split(":", itemKey)
--debugPrint("Searching",key,"for",text,"Sucess: link is",itemLink)
local itemLink = lib.API.createItemLinkFromArray(itemKey)
return itemID, itemLink
end
end
debugPrint("Searching DB for ItemID..", key, text, "Failed Item does not exist in the name array")
return nil
end