Originally Posted by Kanegasi
Define a local table at the top of your addon and use keys instead of separate variables.
For example:
Lua Code:
-- instead of this local a, b, c, d, e = 1, 2, 3, 4, 5 -- use this local vars = {} vars.a, vars.b, vars.c, vars.d, vars.e = 1, 2, 3, 4, 5
|
The entire appeal of using local variables aside from limiting scope is you save an index lookup in the global table. Putting variables in a local table completely negates this since you're re-adding the index operation you were trying to save.