*Example Code
local function add(x, y)
local result = x + y
return result
end
In this code, is the result variable garbage collected after being returned?
*Example Code
local function add(x, y)
local result = x + y
return result
end
In this code, is the result variable garbage collected after being returned?
Yes, the result is garbage collected after being returned, provided there are no references to it elsewhere.
Thanks for replying with the answer!
Lua, Python, JavaScript – Garbage-Collected
C, C++ – Manual Management
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.