some refactoring and shortcuts for and/or operators

This commit is contained in:
Manuel Simon Hirsig
2016-07-29 11:39:59 +02:00
parent e69fa45826
commit 5e3138c9e7
9 changed files with 159 additions and 141 deletions
+21 -6
View File
@@ -71,9 +71,7 @@ function public.on_load()
btn:SetWidth(65)
btn:SetHeight(24)
btn:SetText('Close')
btn:SetScript('OnClick',function()
HideUIPanel(this:GetParent())
end)
btn:SetScript('OnClick', Aux.f(HideUIPanel, AuxFrame))
public.close_button = btn
end
@@ -198,6 +196,25 @@ function private.on_addon_loaded()
end
end
function public.f(func, ...)
return function()
return func(unpack(arg))
end
end
function public.m(object, method, ...)
return m.f(object[method], object, unpack(arg))
end
do
local x = 0
function public.unique()
x = x + 1
return x
end
end
do
local locked
@@ -274,9 +291,7 @@ function private.setup_hooks()
m.hook('AuctionFrame_OnShow', function(...)
if not m.blizzard_ui_shown then
m.control.as_soon_as(function() return AuctionFrame:GetScript('OnHide') == blizzard_ui_on_hide end, function()
HideUIPanel(AuctionFrame)
end)
m.control.as_soon_as(function() return AuctionFrame:GetScript('OnHide') == blizzard_ui_on_hide end, Aux.f(HideUIPanel, AuctionFrame))
end
return m.orig.AuctionFrame_OnShow(unpack(arg))
end)