Hi all
I need to loop through all equipped bags including the reagents bag.
After 10.2 changed the way we reach bags and the new reagents bag my original loop was;
Lua Code:
for bag = 0, 4 do -- check each bag
for slot = 0, GetContainerNumSlots(bag) do -- check each bag slot
local itemID = GetContainerItemID(bag, slot)
This used to loop through all my equipped bags, starting with the backpack(0) and each following bag(1-4)
From reading the new changes it shows that the new reagents bag(-3)
So to test I used;
Lua Code:
name = C_Container.GetBagName(-3)
print(name)
This returns nothing, no errors, not even a nil;
So then I tried using the bag constants;
Lua Code:
for bag = BACKPACK_CONTAINER, NUM_BAG_SLOTS,BACKPACK_CONTAINER+NUM_BAG_SLOTS+1 do
for slot = 1, C_Container.GetContainerNumSlots(bag) do
local itemLink = C_Container.GetContainerItemLink(bag, slot)
if itemLink then
print(bag, slot, itemLink)
end
end
end
This looped through the backpack only.
If I remove the backpack;
Lua Code:
for bag = NUM_BAG_SLOTS,BACKPACK_CONTAINER+NUM_BAG_SLOTS+1 do
for slot = 1, C_Container.GetContainerNumSlots(bag) do
local itemLink = C_Container.GetContainerItemLink(bag, slot)
if itemLink then
print(bag, slot, itemLink)
end
end
end
Which loops through all the bags excluding the backpack.
At this point I am lost, I still have not found a fool, (me being the fool), proof way to loop through all the bags in one sweep.
What am I missing here?
How do I loop through all equipped bags, backpack, bags 1-4 and the reagent bag in one go?