--script.lua local x = 0
--main.lua dofile("script.lua")
Now we are out of script.lua scope, so we can't directly access x variable. But it still exists and its definition occupies memory even if x == nil. How can I delete x completely? Or How can I load thousands of scripts to do some stuff and release these scripts one by one completely? I dont need their locals in my memory anymore
The only thing that worked is BAD EVIL globals. If i use global x = 0, then x = nil do what i want, but every pro lua user keep saying that globals are bad.
Those locals are still referenced by the global functions.
And that reference is, if I understood correctly, a upvalue: