Please avoid
Lua Code:
local bagSlots = GetBagSize(bagId) -1
for slotIndex = 0, bagSlots do
local itemType = GetItemType(bagId, slotIndex)
to itarate bags.
Use :
Lua Code:
local bagCache = SHARED_INVENTORY:GenerateFullSlotData(nil, BAG_BACKPACK)
for slotId, data in pairs(bagCache) do
instead.
1st, the first snipped don't really work work Guild Bank.
2nd, sometimes , it don't work neither in bag. (even it's more rare).
And most of all, please consider that slotIndex is data.slotIndex and not in the key.