After the gobal has been created you can alway do
Code:
local db = MyVeryLongGlobaVariableName
When using tables, making changes to the local eg.
Code:
db.SomeVariable = "SomeThing New"
Will change the entry in the MyVeryLongGlobaVariableName table.
With other simple types (strings, numbers etc.) changing the local variable won't change the global.
Global names don't have to be uber long, just unique. The addon (folder) name will always be unique (or acronym with something like
_DATA after it.)
locals are scope restricted so a local defined in anything the ends with an END (if, function etc.) will only be available in that scope.
Code:
local a = 2
print(a) -- prints 2
if 1 == 1 then
print(a) -- prints 2
local a = 3
print(a) -- prints 3
end
print(a) -- prints 2, back to original "scope"