lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

 Hi All,

Given the following script held in a get_t.lua file:

local t = {
  -- Initialization of fields in t.

-- Code that manipulates fields in t.

return t

and the following main.lua file:

local t = loadfile( 'get_t.lua' )()

-- Use t.

-- Code that runs for a long time and that doesn't
-- reference t anymore follows...

Can I count on t being garbage-collected, and also the bytecode generated by loading get_t.lua along with all local variables and functions declared in it? Consider that main.lua will be creating tables, strings and userdata so the GC will be triggered eventually.

I'm aware of require and stuff but since the results of get_t.lua will be used just once I don't want it to be lying around while main.lua runs.