I need to make my own addon that modifies a few others so that I don't have to modify their files every time they have an update.
So I went to look into how GW2 UI interacts with the Immersion addon:
Lua Code:
local _, GW = ...
local function SkinImmersionAddonFrame()
local ImmersionFrame = _G.ImmersionFrame
if ImmersionFrame then
ImmersionFrame.TalkBox.BackgroundFrame.TextBackground:SetTexture("Interface/AddOns/GW2_UI/textures/party/manage-group-bg")
ImmersionFrame.TalkBox.Hilite:Hide()
ImmersionFrame.TalkBox.MainFrame.Indicator:SetPoint("TOPRIGHT", -56, -13)
end
end
GW.SkinImmersionAddonFrame = SkinImmersionAddonFrame
There are two things I don't understand in that code:
1. There is a local variable defined, ImmersionFrame. But what is _G.ImmersionFrame? I know that ImmersionFrame is a frame defined in the Immersion addon's XML files, but why the _G? What does it do?
2. The bit that says 'if ImmersionFrame then' checks if the ImmersionFrame exists, correct? How does the GW2 UI addon guarantee that it's going to overwrite what's originally stated in the Immersion addon?