EN VI

Do local variables in lua occupy memory after end of scope?

2024-03-11 17:30:08
How to Do local variables in lua occupy memory after end of scope?

--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.

Solution:

Answer

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login