From 8df041f9e9c76675b1255e8afa050047415c0378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20H=C3=BCskes?= Date: Mon, 21 Nov 2022 03:41:01 +0100 Subject: [PATCH] Use Enums instead of hardcoded values --- module_bags.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module_bags.lua b/module_bags.lua index b99cf6d..0fd73a1 100755 --- a/module_bags.lua +++ b/module_bags.lua @@ -18,7 +18,7 @@ function child:scanBag(bag) if(item) then local itemInfo = C_Container.GetContainerItemInfo(bag, slot) local id = item:GetItemID() - if(id) then + if(itemInfo and id) then empty = false itemlist[id] = itemlist[id] or {} itemlist[id]['count'] = itemlist[id]['count'] or 0 @@ -35,11 +35,11 @@ local function scanAllBags(delayed) local playerID = child.getPID() if(playerID) then local tab = modul['db'][playerID] - for bag=0,4 do + for bag=Enum.BagIndex.Backpack ,Enum.BagIndex.ReagentBag do tab[bag] = child:scanBag(bag) -- loop all bought bags end for k,v in pairs(modul['db'][playerID]) do - if(k<0 or k>4) then + if(kEnum.BagIndex.ReagentBag) then tab[k] = nil -- prevent bogus bags end end