Originally Posted by Yssaril
Its usually best to stay away from creating globals. Less risk of other addons messing with yours and faster variable access
|
Is there a way to scope a variable to only your addon (across several Lua files) without making it global?
Something like...
file1:
local X=555
setup-file2(&X)
X = 444
print X => 444
file2:
local X
function setup-file2(&Y)
X = &Y
end
print X => 444 --after setting it in file1
I don't remember there being any way to equivalence two differently-scoped variables like that in Lua without doing something like a function. But calling a function would probably be slower than using a global.