lua-users home
lua-l archive

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

Edgar Toernig wrote:
>No.  Local variables are kept on a stack and will not effect the GC.

So any local string or table will be freed when you exit a function? That 
sounds good.

>     for i=1,100 do  x="foo"..tostring(i)  end  -- 100 new strings

What about if x is a declare a local? Will only the last string assign to x
be free when the function exit? And the other 99 strings be GC?

Same questions goes for table: So if I have

function foo()
	local x = {"a", "b", "c"}

	x = {"d"}

{"d"} is free when the function exit and {"a", "b", "c"} will be GCed later?

-Virus scanned and cleared ok