lua-users home
lua-l archive

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


luaL_deepcopy( 'table' ) /* with refs */

Yes, please.

and
 luaL_dumptable( 'table' ) /* with refs */

To serialize a table in lua form.


On 3/2/06, Ashwin Hirschi <deery@operamail.com> wrote:
>
> >> In other words, if you setup this table:
> >>
> >> oldtbl["a"] = {"somedata"};
> >> oldtbl["b"] = oldtbl["a"];
> >>
> >> you can copy it to newtbl such that newtbl["a"] would be a new copy of
> >> the "somedata" table, and newtbl["b"] would be a reference to the
> >> *new* table copy in newtbl["a"].
> >>
> >> I know, wishful thinking, but anyhow...
>
> Eh... why wishful thinking? It's not that hard to do, is it?!
>
> The key is to keep track of (i.e. a mapping of) table copies you make.
>
> Ashwin.
> --
> no signature is a signature.
>