Apologies for the terrible Wizard of Oz reference, and more apologies if this topic has already been brought up.
I'd like to start by saying that I'm amazed at what this community has accomplished in such a short amount of time. You guys have extended ESO's UI by leaps and bounds since launch, and I love using your addons!
One thing I've noticed while checking out your code is that most of the functions live in global scope. Since lua doesn't have any real namespace support (I'm not counting tables), I humbly suggest either:
- Prefixing your global functions with a "AddOnId_" tag
- Make functions and symbols that don't need to be globally accessible, local instead
The latter is probably a better idea, since accessing locals is much faster than looking something up in _G.
I am mostly bringing this up because when I see a function like initVars declared at global scope, I'm just amazed that it hasn't collided with some other addon I've installed.
Keep in mind that the scope at which something lives is ENTIRELY dictated by the keyword "local":
Code:
local function SomewhatPrivate()
local localToFunction = 5
actuallyGlobal = 6
end
In that case, "actuallyGlobal" is completely accessible to any addon...sometimes this is good, sometimes it isn't.
Anyway, thanks for reading. Hopefully this helps promote clean coding, and reduces potential conflicts and random bugs when players decide to use many of the wonderful addons you authors have provided!