• 0

    posted a message on AceDBOptions and profile updating...
    Alright... NOW I'm thoroughly confused. It no longer errors, but all of the values for everything are nil? Can't change any settings or anything, and it reports all the values as nil even though they're not in the savedvariables file...

    -- Options Table
    local options = {
       name = "Overlord",
       handler = Overlord,
       type = "group",
       args = {
          visibility = {
             type = "group",
             name = L["Visibility"],
             desc = L["Manage Visibility Settings"],
             args = {
                showSolo = {
                   type = "toggle",
                   name = L["Show While Solo"],
                   desc = L["Toggles whether or not to show Overlord while solo."],
                  order = 0,
                    get = Overlord.IsShowSolo,
                    set = Overlord.ToggleShowSolo,
                },
                showInParty = {
                   type = "toggle",
                   name = L["Show While In Party"],
                   desc = L["Toggles whether or not to show Overlord while in parties."],
                  order = 1,
                    get = Overlord.IsShowInParty,
                    set = Overlord.ToggleShowInParty,
                },
                showInRaid = {
                   type = "toggle",
                   name = L["Show While In Raid"],
                   desc = L["Toggles whether or not to show Overlord while in raids."],
                  order = 2,
                    get = Overlord.IsShowInRaid,
                    set = Overlord.ToggleShowInRaid,
                },
             },
          },
    
          debuffs = {
             type = "group",
             name = "Debuffs",
             args = {
                scale = {
                   type = "range",
                   name = "Debuff Bar Scale",
                   desc = "Sets the Debuff Bar scaling",
                    min = 0.50,
                    max = 4.00,
                   step = 0.01,
                bigStep = 0.10,
                    get = Overlord.GetDebuffScale,
                    set = Overlord.SetDebuffScale,
                },
                backgroundAlpha = {
                   type = "range",
                   name = "Debuff Bar Background Alpha",
                   desc = "Sets the Debuff Bar scaling",
                    min = 0.00,
                    max = 1.00,
                   step = 0.01,
                bigStep = 0.10,
                    get = Overlord.GetDebuffBackgroundAlpha,
                    set = Overlord.SetDebuffBackgroundAlpha,
                },
             },
          },
       },
    }
    Nothing else has changed from the pasty
    Posted in: Lua Code Discussion
  • 0

    posted a message on AceDBOptions and profile updating...
    Ah syntax... Sometimes I wish everything was just written in scheme >_>
    Posted in: Lua Code Discussion
  • 0

    posted a message on AceDBOptions and profile updating...
    Alright, made the change, but now I get yelled at about it "expecting function arguments near ," or if I make that chance that they're nil... Thoughts?
    Posted in: Lua Code Discussion
  • 0

    posted a message on AceDBOptions and profile updating...
    Ah okay, that makes sense... DBOptions doesn't have a pointer to the function cause I'm passing it as a string and not a function. Figured it was something like that, but I couldn't find it for the life of me. Too much time coding today, not enough sunlight >_<
    Posted in: Lua Code Discussion
  • 0

    posted a message on AceDBOptions and profile updating...
    http://www.pastey.net/112572

    edit:
    I know there are still some efficiency problems / best practices to uphold, but the code functions, and since it's not in the release candidate stages yet, I haven't bothered to fix them XD
    Posted in: Lua Code Discussion
  • 0

    posted a message on AceDBOptions and profile updating...
    Alright, I'm using AceDBOptions to generate the options table for all the profile stuff in my addon, and all of that works fine, except for the fact that AceDBOptions doesn't seem to fire any of the set functions for the values it updates. That is to say that when a user changes profiles, all of the values are changed, but none of my set functions are fired, thus none of the values are actually updated. This forces them to reloadui to see the change.

    Is there a way to fix it so that it fires my set functions, or at least fires a function I can overide to update my frames and such based on the new values?

    edit:
    A little more in-depth explanation... Say the user sets the scale of one of my frames from 1 to 2. The frame will update to the new scale. Now say the user changes profiles to a profile with a scale of 3. The user will see the frame at a scale of 2, but the variable storing the scale will be set to 3. My function in the set method for the scale option in my options table updates the frame to it's new scale, and it's never being fired on profile change. They need to reloadui to get it to fire.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Free a frame so it gets garbage collected?
    Quote from yssaril
    second if using the local frame should be faster since if you where to adjust debuffFrames[offset] itself then lua would have to lookup what debuffFrames[offset] is each time whereas if you save the reference of debuffFrames[offset] to frame lua know what to do wit it much faster since upvalues (locals) are saved on the stack

    That's the explanation I was looking for, thank you XD
    Posted in: Lua Code Discussion
  • 0

    posted a message on Free a frame so it gets garbage collected?
    So here's my question then, how is that more efficient than just working with the same variable? The way i'm seeing it, it's creating a new local variable every time the function is run, just to do some stuff and put it back into a variable we already had... Shouldn't it be more efficient to just do the work on the variable directly, or is there some nuance of WoW's Lua implementation that I'm missing?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Free a frame so it gets garbage collected?
    Fixed it. Because I was using OrionShock's suggestion of storing them into a local, it wasn't ever actually updating self.debuffFrames so it was actually empty. repalced all the local frame calls with self.debuffFrames again and it works fine now.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Free a frame so it gets garbage collected?
    Alright, now this is weird... My cleanup code doesn't seem to be running.

    it enters the function, but never executes an itteration of the for ipairs. It's acting as if the self.debuffFrames array is empty, even though it shouldn't be.

    prints out "Starting Cleanup" in all the right places, but never prints out "Cleaning debuff slot"
    function Overlord:ClearDebuffs()
       self.Print("Starting Cleanup")
       for i, debuff in ipairs(self.debuffFrames) do
            self.Print("Clearing debuff slot: " .. i)
            debuff:SetBackdrop(nil)
       end
    end


    edit: tacked on a #self.debuffFrames and it IS empty... yet it's filled the second it shows any of the frames, which it IS doing).
    Posted in: Lua Code Discussion
  • 0

    posted a message on Free a frame so it gets garbage collected?
    Ah ha! That explains the memory increase.

    Changed it to:

    oninitialize:
       -- Generic backdrop array for frame recycling
       self.debuffBackdrop = {bgFile = nil, edgeFile = nil, insets = nil}


    on frame creation:
       self.debuffBackdrop.bgFile = "Interface\\Icons\\" .. texture
    
       self.debuffFrames[offset]:SetBackdrop(self.debuffBackdrop)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Free a frame so it gets garbage collected?
    Alright, I haven't done this in a while, but I think I implemented this properly. Mind taking a look to make sure this actually does recycle the frames like I think it does?

    onInitialize:
       -- Create a frame to show things on
       self:CreateFrame()
    
       -- Storage array for frame recycling
       self.debuffFrames = {}
    self:CreateFrame() is generating self.debuffBarFrame that everything is anchored to, and thus isn't dynamic.

    frame creation:
    function Overlord:AddDebuff(texture, offset)
    
       if self.debuffFrames[offset] == nil then
          self.debuffFrames[offset] = CreateFrame("FRAME", nil, self.debuffBarFrame)
       end
    
       self.debuffFrames[offset]:SetBackdrop({
          bgFile = "Interface\\Icons\\" .. texture,
          edgeFile = nil,
          insets = nil,
       })
    
       self.debuffFrames[offset]:SetWidth(16)
       self.debuffFrames[offset]:SetHeight(16)
       self.debuffFrames[offset]:ClearAllPoints()
       self.debuffFrames[offset]:SetPoint("TOPLEFT", self.debuffBarFrame, "TOPLEFT", 2 + (18 * offset), -2)
    
       self.debuffBarFrame:SetWidth(20 + (18 * offset))
    end
    clearing frames for next use:
    function Overlord:ClearDebuffs()
       for _, debuff in ipairs(self.debuffFrames) do
            debuff:SetBackdrop(nil)
       end
    end
    Posted in: Lua Code Discussion
  • 0

    posted a message on Free a frame so it gets garbage collected?
    Alright, manually it is then :P
    Posted in: Lua Code Discussion
  • 0

    posted a message on Free a frame so it gets garbage collected?
    What about AceGUI? Seems to implement a widget pool, or is that not what I think it is?

    http://www.wowace.com/projects/ace3/pages/api/ace-gui-3-0/
    Posted in: Lua Code Discussion
  • 0

    posted a message on Free a frame so it gets garbage collected?
    Quick additional question, is there an Ace API out there these days that handles frame recycling, or do we still have to implement it by hand?
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.