lua-users home
lua-l archive

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


> lets say I need to reset a table to some older state. Will this work?:
> MyTable = OlderTable;
> and what would happen to C refs which are attached to 'MyTable'?

With the assignment you only assign a reference to the table.
After this instruction, both MyTable and OlderTable refer to the
same structure. If you change one, the change is visible from the
other, too.

If MyTable was the only reference to that table, before you re-
assigned it, the table still stays in memory and will sometime
be collected by the garbage collector (at least at program exit).

If there are other references left, nothing will happen to the table.


ok, I understand. So there are no easy copytable() type abilities inside lua's base lib?

_________________________________________________________________
Send a QuickGreet with MSN Messenger http://www.msnmessenger-download.com/tracking/cdp_games