lua-users home
lua-l archive

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


I see. Thanks for pointing this out.

Ulrich.

Am 14.12.2013 10:42, schrieb Coda Highland:
On Fri, Dec 13, 2013 at 11:34 PM, Ulrich Schmidt <u.sch.zw@gmx.de> wrote:
You are right. May be i am to much lua beginner to see the benefit of your
approach compared to

tablevar = setmetatable({}, getmetatable(tablevar))

The only difference i can see is, that table.clear() would do (parts of)
the _gc job sooner.

I explained this in an earlier post -- the difference is if there's
more than one reference to the table hanging around. Making a new
table in Lua code and assigning it to the variable leaves those other
tables unaltered, which is almost surely NOT what you wanted to do.

/s/ Adam