lua-users home
lua-l archive

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


On Mon, Feb 23, 2009 at 3:24 AM, Fabien <fleutot+lua@gmail.com> wrote:

> do you handle shared sub-tables? i.e. would tables t1 and t2 below be
> serialized correctly?
>
> x = { }
> t1 = { x, x }
> t2 = { }; t2[1] = t2
>
> If not, do you plan to ever support these?

References are currently serialized once for each time encountered:

    x = { }; { x, x }

Becomes

    { { }, { } }

Recursive table serialization fails as attempt to save table with more
than 250 nesting levels (arbitrary customizable value). (Note that
current implementation does twice as much recursive C calls in this
case.)

If there is a popular support in fixing these two issues, I will do
so. I think there would be a separate save function with support for
these extra features (as my main use case does not require them, and
they would affect performance), but a load function would handle
output of both save functions.

Alexander.