How to confirm an item is not in a database

Post Reply
jbrumble
Posts: 15
Joined: Sat Jan 09, 2021 4:31 am

How to confirm an item is not in a database

Post 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!

Post Reply