From d7c64d7d0a740ac966a45a9dbf3435d783ffd0bf Mon Sep 17 00:00:00 2001 From: shagu Date: Sat, 6 Apr 2019 14:30:31 +0200 Subject: [PATCH] core: replace remaining getglobals in favor of _G --- api/api.lua | 2 +- api/ui-widgets.lua | 4 ++-- api/unitframes.lua | 4 ++-- modules/addonbuttons.lua | 22 +++++++++++----------- modules/gm.lua | 2 +- modules/loot.lua | 4 ++-- modules/raid.lua | 2 +- modules/skin.lua | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/api/api.lua b/api/api.lua index 6bdcc21f..cffac804 100644 --- a/api/api.lua +++ b/api/api.lua @@ -833,7 +833,7 @@ function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor button._anchor = {"TOPLEFT", parent, "TOPLEFT", bordersize+padding, -bordersize-padding} else 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 return button._anchor end diff --git a/api/ui-widgets.lua b/api/ui-widgets.lua index c6c9e6eb..42030610 100644 --- a/api/ui-widgets.lua +++ b/api/ui-widgets.lua @@ -272,7 +272,7 @@ end -- 'icon' [texture] the button icon that should be skinned. -- 'disableHighlight' [bool] disable mouseover highlight. 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 return end if not cr or not cg or not cb then @@ -312,7 +312,7 @@ end -- Applies pfUI skin to collapse/expand buttons: -- 'button' [frame/string] the button that should be skinned. 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 return end diff --git a/api/unitframes.lua b/api/unitframes.lua index 970d1775..69cb511b 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -1522,11 +1522,11 @@ function pfUI.uf:ClickAction(button) elseif label == "pet" then ToggleDropDownMenu(1, nil, PetFrameDropDown, "cursor") 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 local name = this.lastUnit 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") end else diff --git a/modules/addonbuttons.lua b/modules/addonbuttons.lua index 739694a5..741c212f 100644 --- a/modules/addonbuttons.lua +++ b/modules/addonbuttons.lua @@ -145,8 +145,8 @@ pfUI:RegisterModule("addonbuttons", function () sum_size = 0 buttons_count = GetNumButtons() for i, button_name in ipairs(pfUI.addonbuttons.buttons) do - if getglobal(button_name) ~= nil then - sum_size = sum_size + getglobal(button_name):GetHeight() + if _G[button_name] ~= nil then + sum_size = sum_size + _G[button_name]:GetHeight() end end calculated_scale = GetButtonSize() / (sum_size / buttons_count) @@ -194,7 +194,7 @@ pfUI:RegisterModule("addonbuttons", function () ScanForButtons() for i, button_name in ipairs(pfUI_cache["abuttons"]["add"]) do 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) end end @@ -205,7 +205,7 @@ pfUI:RegisterModule("addonbuttons", function () end end 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)) end end @@ -249,7 +249,7 @@ pfUI:RegisterModule("addonbuttons", function () local function RestoreButton(frame) 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:SetMovable(frame.backup.is_movable) frame:SetScale(frame.backup.scale) @@ -315,7 +315,7 @@ pfUI:RegisterModule("addonbuttons", function () local button if arg and arg ~= "" then - button = getglobal(arg) + button = _G[arg] else button = GetMouseFocus() end @@ -330,11 +330,11 @@ pfUI:RegisterModule("addonbuttons", function () if action == "reset" then 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 table.remove(pfUI.addonbuttons.buttons, TableMatch(pfUI.addonbuttons.buttons, button_name)) end - RestoreButton(getglobal(button_name)) + RestoreButton(_G[button_name]) end end pfUI_cache["abuttons"]["add"] = {} @@ -383,9 +383,9 @@ pfUI:RegisterModule("addonbuttons", function () function pfUI.addonbuttons:ProcessButtons() UpdatePanel() for i, button_name in ipairs(pfUI.addonbuttons.buttons) do - if getglobal(button_name) ~= nil then - BackupButton(getglobal(button_name)) - MoveButton(i, getglobal(button_name)) + if _G[button_name] ~= nil then + BackupButton(_G[button_name]) + MoveButton(i, _G[button_name]) end end end diff --git a/modules/gm.lua b/modules/gm.lua index 5d1b229c..71b23e35 100644 --- a/modules/gm.lua +++ b/modules/gm.lua @@ -87,7 +87,7 @@ pfUI:RegisterModule("gm", function () -- table.insert(UnitPopupMenus["PET"], "GM_HEADER") hooksecurefunc("UnitPopup_OnClick", function() - local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU) + local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU] local button = this.value local unit = dropdownFrame.unit local name = dropdownFrame.name diff --git a/modules/loot.lua b/modules/loot.lua index 25142411..e0bb7965 100644 --- a/modules/loot.lua +++ b/modules/loot.lua @@ -388,7 +388,7 @@ pfUI:RegisterModule("loot", function () pfUI.loot:RemoveMasterlootMenus() -- remove then add to ensure no duplicate menus pfUI.loot:AddMasterLootMenus() hooksecurefunc("UnitPopup_OnClick",function() - local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU) + local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU] if not dropdownFrame then return end local button = this.value local unit = dropdownFrame.unit @@ -401,7 +401,7 @@ pfUI:RegisterModule("loot", function () end end) hooksecurefunc("UnitPopup_HideButtons",function() - local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU) + local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU] local unit = dropdownFrame.unit local name = dropdownFrame.name for index,value in pairs(UnitPopupMenus[dropdownFrame.which]) do diff --git a/modules/raid.lua b/modules/raid.lua index b48ad6e4..007a5359 100644 --- a/modules/raid.lua +++ b/modules/raid.lua @@ -88,7 +88,7 @@ pfUI:RegisterModule("raid", function () end hooksecurefunc("UnitPopup_OnClick", function() - local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU) + local dropdownFrame = _G[UIDROPDOWNMENU_INIT_MENU] local button = this.value local unit = dropdownFrame.unit local name = dropdownFrame.name diff --git a/modules/skin.lua b/modules/skin.lua index 4710d0bb..1d754afa 100644 --- a/modules/skin.lua +++ b/modules/skin.lua @@ -46,12 +46,12 @@ pfUI:RegisterModule("skin", function () if C.appearance.cd.blizzard == "1" then hooksecurefunc("PaperDollItemSlotButton_Update", function() - local cooldown = getglobal(this:GetName().."Cooldown") + local cooldown = _G[this:GetName().."Cooldown"] if cooldown then cooldown.pfCooldownType = "ALL" end end) hooksecurefunc("SpellButton_UpdateButton", function() - local cooldown = getglobal(this:GetName().."Cooldown") + local cooldown = _G[this:GetName().."Cooldown"] if cooldown then cooldown.pfCooldownType = "ALL" end end) end @@ -76,7 +76,7 @@ pfUI:RegisterModule("skin", function () GameMenuButtonOptions:SetPoint(point, relativeTo, relativePoint, xOffset, yOffset - 22) for _, box in pairs(boxes) do - local b = getglobal(box) + local b = _G[box] CreateBackdrop(b, nil, true, .8) end