Originally Posted by myrroddin
To illustrate:
Lua Code:
for i = 1, 5 do -- all iterations local var = "dog" print(var) end -- var never needs to be changed local var = "dog" for i = 1, 5 do print(var) end
In the first example, you create five times the amount of garbage collected compared to the second.
|
This is why I can't quite figure out the general statement "define variables in the lowest scope possible"
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.
Remember, every time you post a comment on an add-on, a kitten gets its wings!