1. Hello,

    Im doing a version of BagBuddy to learn how to make addons. This version of BagBuddy I am replacing the quality filters for class filters. You can choose to display armors or weapons.

    I have run into some problems, when show both weapons and armors one of the items gets "written over" in the bagspace. An example is that I have 4 armors displaying and I want to see my weapons as well then one of the armors get over written so only 3 armors and 1 weapon displays, when it should display 5 items.

    Could you possibly give any pointers on what could be wrong and how to fix it?

    Any help is welcome.

    The code: http://pastebin.com/hgtraUWR

    http://pastebin.com/84tJRSQt

    Nothing jumps out at me and its a bit difficult for me to read the code and comments and see what's going on. You've got a few global variables that I can't see what the purpose of and the comments are in a language that I cannot read. I would say that its probably better to create a table that maps filter names (i.e. "Weapon" and "Armor") to the buttons that represent those filters. Then you can change your 'shown' check to the following:

     if GearBuddy.filterClasses then
       local button = GearBuddy.filterButtons[class]
       shown = button and button:GetChecked()
     end
    

    If the filter button doesn't exist (i.e. you haven't implemented it) then those items won's be shown. Otherwise, it grabs the current state of the button.

    The easiest way to figure out what's going on? Add some debug prints to see what items are flagged as 'shown' and make sure that that is correct. If it is, then do the same with the update loop that does the display and see what might be wrong.

    Hello,

    Thanks for the speed reply :)

    Yes some of my comment are writing in Swedish, sorry for that :/ But it some of the code is the same as in BagBuddy as you might noticed, with some expectations in variable names and so on.

    The filter buttons are implemented but dont see how I would change the rest to make it work :(

    I have a print which shows which items should be seen in the slots.

    print("Should show: " .. item.link)

    But it doesn't show all them items its supposed to do.

    I'm trying to print what is in the tables updatedItems but it just returns a nil value so that could be a problem. The other table itemList just return nil values :/ So that may be the problem that it does not write to the table properly.

    Yeah, also make sure you have Lua errors enabled, you may be getting an error and you should heed it carefully!

    The problem may lie in the GearBuddy_Update function. Where I update the items, the if item-part (if entry- in BagBuddy).

    Going to see if I can solve it when I come home!

    It may be so easy that I just forget to write button:Show() ^^