Page 1 of 1

How to confirm an item is not in a database

Posted: Sun Jan 24, 2021 7:16 am
by jbrumble
Hello Folks,

I've been struggling for a couple hours with attempting to check verify that a value in a database does not exist. I suspected that db:is_nil would be the function I need. But I cannot seem to figure out how to get it to return accurately. Either everything is Null or nothing is. The function I've been trying to add the detection to is:

Code: Select all

function findItemID(itemName)

local itemsQuickDatadb = db:get_database("itemsQuickData")

itemData = db:fetch(itemsQuickDatadb.item, db:eq(itemsQuickDatadb.item.inventoryName, itemName))
itemID =(itemData[1]["_row_id"])
fg("light_goldenrod")
echo(" [Item #"..itemID .. "]")
resetFormat()
end
Thank you for any advice you can offer!