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.