> Every distinct variable you allocate needs to be de-allocated by theLocal variables in Lua are not dynamic entities: they are not allocated
> garbage collector once it goes out of scope. So if you declare a dozen
> variables, that is a dozen objects the GC needs to mark and collect. If you
> declare two variables and re-use them with objects of the same type, thats
> only two variables to mark and collect.
(and not deallocated). When a function starts, it gets the space for all
local variables it will need from the stack, an array that more often
than not have space spare for them. So, the cost of "creating" local
variables is virtually zero in Lua.