1. I'm working through the book on live server 4.0.3a and I ran into a little issue. I'm running the BagBuddy_Update function manually. And I added a couple of print statements to help me troubleshoot. This is what caught my attention, Eternal Belt Buckle (I have 2 in my bag) did not have the proper Blue/Rare border. Upon further inspection I noticed a Glacial bat in one of my BagBuddy slots. I don't have a Glacial bag in inventory, I have 4 Glacial bags equipped.

    I added the print statement after

     local texture, count, locked, quality, readable, lootable, link = GetContainerItemInfo(bag, slot)
     if link then print(link) end
    

    and I also added a print statement inside the if statement that stores the data or updates the count

    if not items[itemNum] then
      items[itemNum] = {
        texture = texture,
        count = count,
        quality = quality,
        name = GetItemInfo(link),
        link = link,
        }
        print("Slot: ", itemNum, " Name: ", items[itemNum].name, " Count: ", items[itemNum].count, " Quality: ", items[itemNum].quality)
     else
        -- the item already exists in our table, just update the count
        items[itemNum].count = items[itemNum].count + count
        print("Slot: ", itemNum, " Name: ", items[itemNum].name, " Count: ", items[itemNum].count, " Quality: ", items[itemNum].quality)
     end
    

    Upon running BagBuddy_Update() I get this output on the chat window

     [15:10:23] [Glacial Bag]
     [15:10:23] Slot:  41600  Name:  Glacial Bag  Count:  1  Quality:  3
     [15:10:23] [Fish Feast]
     [15:10:23] Slot:  43015  Name:  Fish Feast  Count:  3  Quality:  -1
     [15:10:23] [Thin Cloth Gloves]
     [15:10:23] Slot:  2119  Name:  Thin Cloth Gloves  Count:  1  Quality:  1
     [15:10:23] [Runic Healing Injector]
     [15:10:23] Slot:  41166  Name:  Runic Healing Injector  Count:  3  Quality:  -1
     [15:10:23] [Wormhole Generator: Northrend]
     [15:10:23] Slot:  48933  Name:  Wormhole Generator: Northrend  Count:  1  Quality:  -1
     ....
     [15:10:23] [Gnomish Army Knife]
     [15:10:23] Slot:  40772  Name:  Gnomish Army Knife  Count:  1  Quality:  -1
     [15:10:23] [Northern Spices]
     [15:10:23] Slot:  43007  Name:  Northern Spices  Count:  1  Quality:  -1
     [15:10:23] [Northern Spices]
     [15:10:23] Slot:  43007  Name:  Northern Spices  Count:  101  Quality:  -1
     [15:10:23] [Eternal Belt Buckle]
     [15:10:23] Slot:  41611  Name:  Eternal Belt Buckle  Count:  2  Quality:  -1
     [15:10:23] [Furious Gladiator's Dreadplate Helm]
     [15:10:23] Slot:  40827  Name:  Furious Gladiator's Dreadplate Helm  Count:  1  Quality:  4
     [15:10:23] [Marrowstrike]
     [15:10:23] Slot:  47522  Name:  Marrowstrike  Count:  1  Quality:  4
     [15:10:23] [Runed Titanium Rod]
     [15:10:23] Slot:  44452  Name:  Runed Titanium Rod  Count:  1  Quality:  -1
     [15:10:23] [Medallion of the Alliance]
     ....
    

    From what I'm seeing stackable items have a -1 either they contain an extra value and we're assigning the wrong value into the quality variable or quality for stackable items is now different. Although I just noticed my Runed Titanium Rod is also showing -1 even though its rare/blue. As far as the Glacial Bag goes I have no clue. It is the very first item to show up as we enter the function, so its Bag 0 Slot 0, I don't know why its showing me my container.

    There was a small issue with the printed code. I've detailed this particular problem in this errata entry. Try making that change and see if it helps resolve this issue, which I believe it should.

    Thanks for the quick response. I modified my code as I noticed the links where properly colored, So GetItemInfo(item) is providing the proper quality where as GetContainerItemInfo(bag, slot) is sometimes giving a -1 for the quality of the item. So for now it seems broken. As for the bag, it seems that only the backpack reports a container in slot = 0, so changed code to start at slot = 1. Love the book BTW, its just what I was looking for.

    I understood everything you said except for 'for now its broken'. Not sure what you're saying..

    GetContainerItemInfo(bag, slot) seems broken for the purpose of obtaining the item quality :D

    Indeed, that is what I state in the errata!

    I defer to your expertise on this one. I'm now in chapter 12, and after thouroughly racking my brain and inspecting everything I've come to a puzzling situation. I thought the problem was my code, so I downloaded the example from chapter12.zip file. And I applied the corrections from the errata where you fixed the issue with quality.

    This is the problem, the line in the bag scanning on the quality filter if statement

     shown = shown and BagBuddy.filters[quality]:GetChecked()
    

    it seems perfectly logical, but it throws an error inside wow

     Date: 2010-11-26 18:11:13
     ID: 1
     Error occured in: Global
     Count: 1
     Message: ..\AddOns\BagBuddy\BagBuddy.lua line 69:
        attempt to index field '?' (a nil value)
     Debug:
        [C]: ?
        BagBuddy\BagBuddy.lua:69: BagBuddy_Update()
        BagBuddy\BagBuddy.lua:192:
           BagBuddy\BagBuddy.lua:183
     AddOns:
       Swatter, v5.9.4960 (WhackyWallaby)
       ACP, v3.3.9 
       BagBuddy, v
       Prat30, v3.4.13      
       Prat30HighCPUUsageModules, v
       Prat30Libraries, v
       WowLua, vv40000-1.0.0 
       BlizRuntimeLib_enUS v4.0.3.40000 <us>
       (ck=cf)
    

    Now. I've thrown a print statement before the shown statement to see what the issue is, and I don't get it. When I add print(BagBuddy.filters[quality]) one line before shown I get all the tables for the buttons

     [18:04:23] table: 0x3fb5e418
     etc etc.
    

    So the global table BagBuddy.filters[quality] is properly working, but when you pass it the method GetChecked() inside the function BagBuddy_Update() the statement fails. Using the GetChecked() method in the function BagBuddy_Filter_OnClick() works without a problem. :S I'm at a loss.

    I've worked around the problem like this:

     function BagBuddy_Filter_OnClick(self, button)
         BagBuddy.qualityFilter = false
         BagBuddy.qualityset = {}
         for idx = 0, 5 do
             local button = BagBuddy.filters[idx]
             if button:GetChecked() then
                 BagBuddy.qualityFilter = true
                 BagBuddy.qualityset[idx] = true
             end
         end
         BagBuddy.page = 1
         BagBuddy_Update()
     end
    

    inside BagBuddy_Update():

         if BagBuddy.qualityFilter then
             shown = shown and BagBuddy.qualityset[quality]
         end
    

    By using a table and setting its items to true when checked inside the OnClick function. This workaround functions just fine, but the error puzzles me, and I'd like to know if you have any idea why it happens, its just odd that a method can be called fine in one function and not in another.

    sorry.... double post.

    The error you are getting indicates that quality is a value for which you don't have an entry in the table, that's all. Has nothing to do with GetChecked() or anything like that.

    Does that help?