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
+11 -11
View File
@@ -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
+1 -1
View File
@@ -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
+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: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
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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