One addon modifying another?
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:
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? |
_G represents the global namespace. So it takes the global one and makes it local.
The changes are made to both of them. (they are the same) Probably you'll see that the toc-file makes sure the other Addon is loaded first. |
As an aside, the _G is not needed in this case because the frame name is added to the global table as a reference when the frame is created (all frames with names are added to the global table by default)
Lua Code:
Code:
if ImmersionFrame then |
Quote:
-- Is it possible to make something happen whenever a local function from another addon happens? Like, when another addon (such as GW2 UI) makes the local funcion LoadMinimap() happen, is it possible to make my own addon do something? |
Quote:
|
All times are GMT -6. The time now is 10:45 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI