core: replace remaining getglobals in favor of _G

This commit is contained in:
shagu
2019-04-06 14:30:31 +02:00
parent 85975eaee1
commit d7c64d7d0a
8 changed files with 23 additions and 23 deletions
+1 -1
View File
@@ -833,7 +833,7 @@ function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor
button._anchor = {"TOPLEFT", parent, "TOPLEFT", bordersize+padding, -bordersize-padding} button._anchor = {"TOPLEFT", parent, "TOPLEFT", bordersize+padding, -bordersize-padding}
else else
local col = buttonindex-((math.ceil(buttonindex/cols)-1)*cols) local col = buttonindex-((math.ceil(buttonindex/cols)-1)*cols)
button._anchor = col==1 and {"TOP",getglobal(basename..(buttonindex-cols)),"BOTTOM",0,-(bordersize*2+padding)} or {"LEFT",getglobal(basename..(buttonindex-1)),"RIGHT",(bordersize*2+padding),0} button._anchor = col==1 and {"TOP",_G[basename..(buttonindex-cols)],"BOTTOM",0,-(bordersize*2+padding)} or {"LEFT",_G[basename..(buttonindex-1)],"RIGHT",(bordersize*2+padding),0}
end end
return button._anchor return button._anchor
end end
+2 -2
View File
@@ -272,7 +272,7 @@ end
-- 'icon' [texture] the button icon that should be skinned. -- 'icon' [texture] the button icon that should be skinned.
-- 'disableHighlight' [bool] disable mouseover highlight. -- 'disableHighlight' [bool] disable mouseover highlight.
function pfUI.api.SkinButton(button, cr, cg, cb, icon, disableHighlight) function pfUI.api.SkinButton(button, cr, cg, cb, icon, disableHighlight)
local b = getglobal(button) local b = _G[button]
if not b then b = button end if not b then b = button end
if not b then return end if not b then return end
if not cr or not cg or not cb then if not cr or not cg or not cb then
@@ -312,7 +312,7 @@ end
-- Applies pfUI skin to collapse/expand buttons: -- Applies pfUI skin to collapse/expand buttons:
-- 'button' [frame/string] the button that should be skinned. -- 'button' [frame/string] the button that should be skinned.
function pfUI.api.SkinCollapseButton(button, all) function pfUI.api.SkinCollapseButton(button, all)
local b = getglobal(button) local b = _G[button]
if not b then b = button end if not b then b = button end
if not b then return end if not b then return end
+2 -2
View File
@@ -1522,11 +1522,11 @@ function pfUI.uf:ClickAction(button)
elseif label == "pet" then elseif label == "pet" then
ToggleDropDownMenu(1, nil, PetFrameDropDown, "cursor") ToggleDropDownMenu(1, nil, PetFrameDropDown, "cursor")
elseif label == "party" then elseif label == "party" then
ToggleDropDownMenu(1, nil, getglobal("PartyMemberFrame" .. this.id .. "DropDown"), "cursor") ToggleDropDownMenu(1, nil, _G["PartyMemberFrame" .. this.id .. "DropDown"], "cursor")
elseif label == "raid" then elseif label == "raid" then
local name = this.lastUnit local name = this.lastUnit
FriendsDropDown.displayMode = "MENU" FriendsDropDown.displayMode = "MENU"
FriendsDropDown.initialize = function() UnitPopup_ShowMenu(getglobal(UIDROPDOWNMENU_OPEN_MENU), "PARTY", unitstr, name, id) end FriendsDropDown.initialize = function() UnitPopup_ShowMenu(_G[UIDROPDOWNMENU_OPEN_MENU], "PARTY", unitstr, name, id) end
ToggleDropDownMenu(1, nil, FriendsDropDown, "cursor") ToggleDropDownMenu(1, nil, FriendsDropDown, "cursor")
end end
else else
+11 -11
View File
@@ -145,8 +145,8 @@ pfUI:RegisterModule("addonbuttons", function ()
sum_size = 0 sum_size = 0
buttons_count = GetNumButtons() buttons_count = GetNumButtons()
for i, button_name in ipairs(pfUI.addonbuttons.buttons) do for i, button_name in ipairs(pfUI.addonbuttons.buttons) do
if getglobal(button_name) ~= nil then if _G[button_name] ~= nil then
sum_size = sum_size + getglobal(button_name):GetHeight() sum_size = sum_size + _G[button_name]:GetHeight()
end end
end end
calculated_scale = GetButtonSize() / (sum_size / buttons_count) calculated_scale = GetButtonSize() / (sum_size / buttons_count)
@@ -194,7 +194,7 @@ pfUI:RegisterModule("addonbuttons", function ()
ScanForButtons() ScanForButtons()
for i, button_name in ipairs(pfUI_cache["abuttons"]["add"]) do for i, button_name in ipairs(pfUI_cache["abuttons"]["add"]) do
if not TableMatch(pfUI.addonbuttons.buttons, button_name) then if not TableMatch(pfUI.addonbuttons.buttons, button_name) then
if getglobal(button_name) ~= nil then if _G[button_name] ~= nil then
table.insert(pfUI.addonbuttons.buttons, button_name) table.insert(pfUI.addonbuttons.buttons, button_name)
end end
end end
@@ -205,7 +205,7 @@ pfUI:RegisterModule("addonbuttons", function ()
end end
end end
for i, button_name in ipairs(pfUI.addonbuttons.buttons) do for i, button_name in ipairs(pfUI.addonbuttons.buttons) do
if getglobal(button_name) == nil then if _G[button_name] == nil then
table.remove(pfUI.addonbuttons.buttons, TableMatch(pfUI.addonbuttons.buttons, button_name)) table.remove(pfUI.addonbuttons.buttons, TableMatch(pfUI.addonbuttons.buttons, button_name))
end end
end end
@@ -249,7 +249,7 @@ pfUI:RegisterModule("addonbuttons", function ()
local function RestoreButton(frame) local function RestoreButton(frame)
if frame.backup ~= nil then if frame.backup ~= nil then
getglobal(frame.backup.top_frame_name):SetParent(frame.backup.parent_name) _G[frame.backup.top_frame_name]:SetParent(frame.backup.parent_name)
frame:SetClampedToScreen(frame.backup.is_clamped_to_screen) frame:SetClampedToScreen(frame.backup.is_clamped_to_screen)
frame:SetMovable(frame.backup.is_movable) frame:SetMovable(frame.backup.is_movable)
frame:SetScale(frame.backup.scale) frame:SetScale(frame.backup.scale)
@@ -315,7 +315,7 @@ pfUI:RegisterModule("addonbuttons", function ()
local button local button
if arg and arg ~= "" then if arg and arg ~= "" then
button = getglobal(arg) button = _G[arg]
else else
button = GetMouseFocus() button = GetMouseFocus()
end end
@@ -330,11 +330,11 @@ pfUI:RegisterModule("addonbuttons", function ()
if action == "reset" then if action == "reset" then
for i, button_name in ipairs(pfUI_cache["abuttons"]["add"]) do for i, button_name in ipairs(pfUI_cache["abuttons"]["add"]) do
if getglobal(button_name) ~= nil then if _G[button_name] ~= nil then
if TableMatch(pfUI.addonbuttons.buttons, button_name) then if TableMatch(pfUI.addonbuttons.buttons, button_name) then
table.remove(pfUI.addonbuttons.buttons, TableMatch(pfUI.addonbuttons.buttons, button_name)) table.remove(pfUI.addonbuttons.buttons, TableMatch(pfUI.addonbuttons.buttons, button_name))
end end
RestoreButton(getglobal(button_name)) RestoreButton(_G[button_name])
end end
end end
pfUI_cache["abuttons"]["add"] = {} pfUI_cache["abuttons"]["add"] = {}
@@ -383,9 +383,9 @@ pfUI:RegisterModule("addonbuttons", function ()
function pfUI.addonbuttons:ProcessButtons() function pfUI.addonbuttons:ProcessButtons()
UpdatePanel() UpdatePanel()
for i, button_name in ipairs(pfUI.addonbuttons.buttons) do for i, button_name in ipairs(pfUI.addonbuttons.buttons) do
if getglobal(button_name) ~= nil then if _G[button_name] ~= nil then
BackupButton(getglobal(button_name)) BackupButton(_G[button_name])
MoveButton(i, getglobal(button_name)) MoveButton(i, _G[button_name])
end end
end end
end end
+1 -1
View File
@@ -87,7 +87,7 @@ pfUI:RegisterModule("gm", function ()
-- table.insert(UnitPopupMenus["PET"], "GM_HEADER") -- table.insert(UnitPopupMenus["PET"], "GM_HEADER")
hooksecurefunc("UnitPopup_OnClick", function() hooksecurefunc("UnitPopup_OnClick", function()
local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU) local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU]
local button = this.value local button = this.value
local unit = dropdownFrame.unit local unit = dropdownFrame.unit
local name = dropdownFrame.name local name = dropdownFrame.name
+2 -2
View File
@@ -388,7 +388,7 @@ pfUI:RegisterModule("loot", function ()
pfUI.loot:RemoveMasterlootMenus() -- remove then add to ensure no duplicate menus pfUI.loot:RemoveMasterlootMenus() -- remove then add to ensure no duplicate menus
pfUI.loot:AddMasterLootMenus() pfUI.loot:AddMasterLootMenus()
hooksecurefunc("UnitPopup_OnClick",function() hooksecurefunc("UnitPopup_OnClick",function()
local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU) local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU]
if not dropdownFrame then return end if not dropdownFrame then return end
local button = this.value local button = this.value
local unit = dropdownFrame.unit local unit = dropdownFrame.unit
@@ -401,7 +401,7 @@ pfUI:RegisterModule("loot", function ()
end end
end) end)
hooksecurefunc("UnitPopup_HideButtons",function() hooksecurefunc("UnitPopup_HideButtons",function()
local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU) local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU]
local unit = dropdownFrame.unit local unit = dropdownFrame.unit
local name = dropdownFrame.name local name = dropdownFrame.name
for index,value in pairs(UnitPopupMenus[dropdownFrame.which]) do for index,value in pairs(UnitPopupMenus[dropdownFrame.which]) do
+1 -1
View File
@@ -88,7 +88,7 @@ pfUI:RegisterModule("raid", function ()
end end
hooksecurefunc("UnitPopup_OnClick", function() hooksecurefunc("UnitPopup_OnClick", function()
local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU) local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU]
local button = this.value local button = this.value
local unit = dropdownFrame.unit local unit = dropdownFrame.unit
local name = dropdownFrame.name local name = dropdownFrame.name
+3 -3
View File
@@ -46,12 +46,12 @@ pfUI:RegisterModule("skin", function ()
if C.appearance.cd.blizzard == "1" then if C.appearance.cd.blizzard == "1" then
hooksecurefunc("PaperDollItemSlotButton_Update", function() hooksecurefunc("PaperDollItemSlotButton_Update", function()
local cooldown = getglobal(this:GetName().."Cooldown") local cooldown = _G[this:GetName().."Cooldown"]
if cooldown then cooldown.pfCooldownType = "ALL" end if cooldown then cooldown.pfCooldownType = "ALL" end
end) end)
hooksecurefunc("SpellButton_UpdateButton", function() hooksecurefunc("SpellButton_UpdateButton", function()
local cooldown = getglobal(this:GetName().."Cooldown") local cooldown = _G[this:GetName().."Cooldown"]
if cooldown then cooldown.pfCooldownType = "ALL" end if cooldown then cooldown.pfCooldownType = "ALL" end
end) end)
end end
@@ -76,7 +76,7 @@ pfUI:RegisterModule("skin", function ()
GameMenuButtonOptions:SetPoint(point, relativeTo, relativePoint, xOffset, yOffset - 22) GameMenuButtonOptions:SetPoint(point, relativeTo, relativePoint, xOffset, yOffset - 22)
for _, box in pairs(boxes) do for _, box in pairs(boxes) do
local b = getglobal(box) local b = _G[box]
CreateBackdrop(b, nil, true, .8) CreateBackdrop(b, nil, true, .8)
end end