local t = {}
t["_temporary_"] = ""
t[1] = "hello world"
t[2] = "goodbye world"
This is a waste of time, since t is not in the global table, it will never qualify for being saved, so no temporary needed.
Everything that is defined local is not the global table.
You can also define functions as local:
local function test()
end
which equals to
local test = function()
end
It's all a question of where do you want to access it, if it should only be visible to the script it's a local.
About the out of scope thing: Lua doesn't have a scope. It works only with reference counting. Example:
local t = {}
function f()
t[1] = 0
end
-- t is referenced and will not be collected
f = 0 -- f and t are now unreferenced and will be collected
While t would be out of scope once the function is left, it is not collected.