lua-users home
lua-l archive

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


Am 02.12.2013 11:51 schröbte Luiz Henrique de Figueiredo:
You may also use the *same* table for all your userdata objects and index
it with the userdata each time. You'll probably need to use a weak table
to avoid freezing garbage.


I'm not sure I would recommend that in general any more. A long-lived (weak) table can grow pretty large if at one point it has lots of entries, and will stay that way until it is garbage-collected. See the recent thread on "table.new in 5.3".

Philipp


p.s.: The function is called `lua_setuservalue` not `lua_setusertable`. Just saying ...