1. I'm currently working on developing an addon that tracks kills by name of monster or player. I want to use a lua table to store all of this information but I'm not sure if WoW will save the table between game sessions. I know that global variables can be saved in this fashion, but I'm not sure if that includes tables etc. If tables can't be saved like this between play sessions, how can I efficiently save the information in the table so that a payer can keep a running count of kills since character creation or addon install?

    Also, I've examined a simply addon that labels onto the UI but it deals with just one string that can have '\n' in it to make spaces. I don't think this will work if I want to display multiple labels, one for each creature killed. I've considered making a display table, but I have no idea how to do this. I've looked at Historian and seen that inside of each of the tabs there is a list of information, including a tab that does the same thing my addon wants to do, but I'm clueless in how to put information in frame like that, let alone how to make multiple frames.

    Thanks in advance for any help.

  2. I'm currently working on developing an addon that tracks kills by name of monster or player. I want to use a lua table to store all of this information but I'm not sure if WoW will save the table between game sessions. I know that global variables can be saved in this fashion, but I'm not sure if that includes tables etc. If tables can't be saved like this between play sessions, how can I efficiently save the information in the table so that a payer can keep a running count of kills since character creation or addon install?

    That's just what SavedVariables are. You list the name of your global table in your table of contents file, and WoW will save and restore it between each session.

    Also, I've examined a simply addon that labels onto the UI but it deals with just one string that can have '\n' in it to make spaces. I don't think this will work if I want to display multiple labels, one for each creature killed. I've considered making a display table, but I have no idea how to do this. I've looked at Historian and seen that inside of each of the tabs there is a list of information, including a tab that does the same thing my addon wants to do, but I'm clueless in how to put information in frame like that, let alone how to make multiple frames.

    You'll want to use multiple font strings, stacked on top of each other. For example, something like this:

     local rows = {}
     for i = 1, 10 do
       local name = "MyRow" .. i
       rows[i] = UIParent:CreateFontString(name, "OVERLAY", "GameFontNormal")
       rows[i]:SetHeight(16)
       rows[i]:SetWidth(100)
     end
    
     -- Anchor the first one
     rows[1]:ClearAllPoints()
     rows[1]:SetPoint("TOPLEFT" PlayerFrame, "BOTTOMLEFT", 0, 0)
    
     for i=2, 10 do
       rows[i]:ClearAllPoints()
       rows[i]:SetPoint("TOPLEFT", rows[i-1], "BOTTOMLEFT", 0, 0)
     end
    
  3.  local rows = {}
     for i = 1, 10 do
       local name = "MyRow" .. i
       rows[i] = UIParent:CreateFontString(name, "OVERLAY", "GameFontNormal")
       rows[i]:SetHeight(16)
       rows[i]:SetWidth(100)
     end
     
     -- Anchor the first one
     rows[1]:ClearAllPoints()
     rows[1]:SetPoint("TOPLEFT" PlayerFrame, "BOTTOMLEFT", 0, 0)
     
     for i=2, 10 do
       rows[i]:ClearAllPoints()
       rows[i]:SetPoint("TOPLEFT", rows[i-1], "BOTTOMLEFT", 0, 0)
     end
    

    Hey, thanks for the reply, I really appreciate it! Just for the sake of personal clarification, the last for loop is anchoring each consecutive row to the row above it, thus 'rows[i-1]' instead of something like 'TOPLEFT' which I assume indicates the top left of the UI frame?

    Also, this is the majority of the code I have for the addon so far, not including my variables or my OnLoad function.

     function Slayer_OnEvent(event,...)
        local player = UnitGUID("player")
        local type = select(2,...)
    
        if(type == "PARTY_KILL" and srcGUID == player) then
            totalKills = totalKills + 1;
            lastKilled = destName;
            SlayerLabel:SetText("Last Killed: " .. lastKilled)
            --SendChatMessage(lastKilled, "SAY", nil, 1);
        end
    
        if (event == "ZONE_CHANGED" or event == "ZONE_CHANGED_NEW_AREA") then
            currentZone = GetZoneText();
            SlayerLabel:SetText("Zone: ".. currentZone)
            --SendChatMessage(lastKilled, "SAY", nil, 1);
        end
     end
    

    I post it because I'm having issues with it labeling the zone correctly. Right now the UI frame shows 'Zone ' and 'Last Killed ', I haven't tested the killing portion yet, but whenever I change zones, the label doesn't always change to be what currentZone is. This might have something to do with how I'm checking to see if the zone changed, but I don't know much about how an OnEvent function should be created. The PLAYERKILL conditional works off of the assumption that the only event I'll be considering is COMBATLOGEVENTUNFILTERED. Do I need to make separate OnEvent functions for each event I want to handle, to make sure that it processes cleanly?

    Thanks again, I really appreciate the help.

  4. Hey, thanks for the reply, I really appreciate it! Just for the sake of personal clarification, the last for loop is anchoring each consecutive row to the row above it, thus 'rows[i-1]' instead of something like 'TOPLEFT' which I assume indicates the top left of the UI frame?

    Yes, but if you wanted to anchor to the TOPLEFT of the UI, you would just replace rows[i-1] with UIParent, which is that object.

    Also, this is the majority of the code I have for the addon so far, not including my variables or my OnLoad function.

     function Slayer_OnEvent(event,...)
      local player = UnitGUID("player")
      local type = select(2,...)
      
      if(type == "PARTY_KILL" and srcGUID == player) then
          totalKills = totalKills + 1;
          lastKilled = destName;
          SlayerLabel:SetText("Last Killed: " .. lastKilled)
          --SendChatMessage(lastKilled, "SAY", nil, 1);
      end
      
      if (event == "ZONE_CHANGED" or event == "ZONE_CHANGED_NEW_AREA") then
          currentZone = GetZoneText();
          SlayerLabel:SetText("Zone: ".. currentZone)
          --SendChatMessage(lastKilled, "SAY", nil, 1);
      end
     end
    

    I post it because I'm having issues with it labeling the zone correctly. Right now the UI frame shows 'Zone ' and 'Last Killed ', I haven't tested the killing portion yet, but whenever I change zones, the label doesn't always change to be what currentZone is. This might have something to do with how I'm checking to see if the zone changed, but I don't know much about how an OnEvent function should be created. The PLAYERKILL conditional works off of the assumption that the only event I'll be considering is COMBATLOGEVENTUNFILTERED. Do I need to make separate OnEvent functions for each event I want to handle, to make sure that it processes cleanly?

    You can only ever have one OnEvent function, so what you're doing is just about right but you should put the PARTY_KILL stuff inside a conditional that checks if the event if COMBAT_LOG_EVENT_UNFILTERED.

  5. You can only ever have one OnEvent function, so what you're doing is just about right but you should put the PARTY_KILL stuff inside a conditional that checks if the event if COMBAT_LOG_EVENT_UNFILTERED.

    Ah, I had considered that and then got distracted by functional decomposition, but since we can only have one OnEvent function, I'll reapply this idea and see if it helps the addon function a little better. Thanks a lot, and I'm enjoying your AddOn book :)!