It avoids recreating a new table every time this function is created (and thus fixes a memory leak).
As I'm new to lua and wanting to learn (plus that I was the one posting some of the code you quoted as a qnd fix :) ) could you please explain about the above statement? Will
Klappa.db.profile.buttons[self.index] = {};
cause an actual memory leak as in memory will never get released (if so why, and how should you "free" a collection with data?), or will it just cause the garbage collector to do more (unnecessary) work?
Assigning a variable the way you mentioned seems like a neat trick and good practise indeed.
If I find some spare time I might dabble with Klappa to see if I could make it so that I have different setups depending on whether I am in a (raid) group or soloing and that Klappa would make the switch automatically when I join/leave. As I have a healer I have very different needs when raiding and soloing :)
That's not impossible to do due to blizzards constraints is it? If so please tell me now before I start messing about ;)
Ive had this happen, but only when i've inadvertently dragged off or replaced the contents of one of the top level buttons.
I've had this too and I think it can be solved by changing:
Klappa.db.profile.buttons[self.index] = {};
to:
local pbuttons = Klappa.db.profile.buttons[self.index].popupButtons;
local npopups = Klappa.db.profile.buttons[self.index].popups;
Klappa.db.profile.buttons[self.index] = {};
Klappa.db.profile.buttons[self.index].popupButtons = pbuttons;
Klappa.db.profile.buttons[self.index].popups = npopups;
close to the top in the function Klappa.Button.prototype:ButtonDrop() in KlappaButton.lua.
Info about the popup buttons is lost when replacing the spell on a main button.
I'm new to lua so this is the qnd way to fix it but at least it seems to work for me locally :)
0
to
I got it working for me locally. Not sure if it is 100% correct but... :)
0
As I'm new to lua and wanting to learn (plus that I was the one posting some of the code you quoted as a qnd fix :) ) could you please explain about the above statement? Will
cause an actual memory leak as in memory will never get released (if so why, and how should you "free" a collection with data?), or will it just cause the garbage collector to do more (unnecessary) work?
Assigning a variable the way you mentioned seems like a neat trick and good practise indeed.
If I find some spare time I might dabble with Klappa to see if I could make it so that I have different setups depending on whether I am in a (raid) group or soloing and that Klappa would make the switch automatically when I join/leave. As I have a healer I have very different needs when raiding and soloing :)
That's not impossible to do due to blizzards constraints is it? If so please tell me now before I start messing about ;)
0
I've had this too and I think it can be solved by changing:
to:
close to the top in the function Klappa.Button.prototype:ButtonDrop() in KlappaButton.lua.
Info about the popup buttons is lost when replacing the spell on a main button.
I'm new to lua so this is the qnd way to fix it but at least it seems to work for me locally :)