Specifically in Lua, will I do any harm by doing this:
for i = 1, 10 do
local foo = bar()
-- do stuff with foo
end
instead of this:
local foo
for i = 1, 10 do
foo = bar()
-- do stuff with foo
end
I mean, will Lua try to allocate new memory for foo
every iteration? Could the first block lead to slower execution?