I just encountered a little problem and hope, someone can give me a hint:
I'm working on a ActionBar-Framework.
While setting the button's position (and size), I want to make sure, the button is not moved again (line 11&12).
lua Code:
--[[ VOID noop()
This prevents the default UI from altering our stuff!
]]
lib.noop = function() end
--[[ VOID MoveButton(BUTTON button, INT sizeX, INT sizeY, ARRAY pos)
Moves a button (which is in use, meaning visible) to the correct position.
ARRAY pos is defined as an array which holds the position information as it is used in SetPoint()
]]
lib.MoveButton = function(button, sizeX, sizeY, pos)
button:ClearAllPoints()
button:SetSize(sizeX, sizeY)
button:SetPoint(unpack(pos))
button.SetSize = lib.noop -- don't do this anymore!
button.SetPoint = lib.noop -- don't do this anymore!
end
Now I want to create an ingame-config, but obviously I can't set the buttons' positions again. I tried to "store" the original function and use it later, but with no success.
Code was:
lua Code:
lib.buttonFunc[button:GetName()..'SetPoint'] = button.SetPoint
lib.buttonFunc is an array and of course, this code was executed before I noop'ed the functions. But the stored value has get noop'ed aswell, I guess because they are only function pointers, not real functions.
Can anybody give me a hint, how I can noop a function, but store it's functionality to use it later on?