49
edits
No edit summary |
|||
| Line 1: | Line 1: | ||
{{wowlua}} | {{wowlua}} | ||
[[ | [[AddOns]] in ''World of Warcraft'' share a single execution environment. As a result, all Addons have access to the same global variables. If one Addon creates a global variable named "foo", then all other addons can use (or overwrite) that same variable. This allows for some really useful things to happen; the most frequently used tactic that takes advantage of this feature is [[Hooking functions|hooking]]. Unfortunately, this can also cause some problems in addons. They will conflict if more than one Addon tries to use the same name for a variable. As a result, Addon authors must ensure that their Addons don't conflict by doing one (or more) of the following: | ||
#Using assuredly-unique names for variables, such as MyAddon_MyFrame_OnLoad | #Using assuredly-unique names for variables, such as MyAddon_MyFrame_OnLoad | ||
#Making their addons [[Object_Oriented_Programming|object-oriented]] | #Making their addons [[Object_Oriented_Programming|object-oriented]] | ||