lua-users home
lua-l archive

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


On Wed, Sep 26, 2018 at 3:21 PM Dirk Laurie <dirk.laurie@gmail.com> wrote:
There is no 'clear' in the table library, so normally one would simply
reassign a new empty table. There are situations where this is
undesirable, e.g. more references to the table are lying around and
you want them to point to the cleared table; there may be values in
string-keyed fields etc.

I guess that's why LuaJITs table library [1] has table.new(narr, nrec) and
table.clear, and OpenResty's fork of LuaJIT [2] has table.clone. Just in
case you happen to use those implementations, and didn't know about
it already.