big refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-20 12:11:07 +02:00
parent c443509808
commit 9c2598646d
16 changed files with 292 additions and 363 deletions
+1 -30
View File
@@ -80,7 +80,7 @@ function VARIABLES_LOADED()
btn:SetWidth(65)
btn:SetHeight(24)
btn:SetText 'Close'
btn:SetScript('OnClick', C(frame.Hide, frame))
btn:SetScript('OnClick', L(frame.Hide, frame))
public.close_button = btn
end
do
@@ -305,35 +305,6 @@ do
end
end
public._this = {}
do
local formal_parameters = {}
for i=1,9 do
local key = '_'..i
public[key] = {}
formal_parameters[m[key]] = i
end
local function call(f, arg1, arg2)
local params = {}
for i=1,arg1.n do
if arg1[i] == _this then
tinsert(params, this)
elseif formal_parameters[arg1[i]] then
tinsert(params, arg2[formal_parameters[arg1[i]]])
else
tinsert(params, arg1[i])
end
end
return f(unpack(params))
end
function public.C(f, ...)
local arg1 = arg
return function(...)
return call(f, arg1, arg)
end
end
end
function public.is_player(name, current)
local realm = GetCVar 'realmName'
return not current and index(g.aux_characters, realm, name) or UnitName 'player' == name