lua-users home
lua-l archive

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


>It's complicated. You need to check each child table you copy against a
>list of already seen tables that you need to maintain as you work
>through everything.
I can't agree more.

>Much easier to write this directly in Lua than in C.
A self-defined function implemented by C makes easier for the users to
deep copy a table.

On Thu, Jan 21, 2021 at 9:17 PM Scott Morgan <blumf@blueyonder.co.uk> wrote:
>
> On 21/01/2021 12:51, 孙世龙 sunshilong wrote:
> > Thank you for your clarification.
> >
> > I think comparing the pointers of the outer table and inner table
> > could find out whether it's a recursive table or not.
> > Am I right? If I miss something,  please let me know.
>
> It's complicated. You need to check each child table you copy against a
> list of already seen tables that you need to maintain as you work
> through everything.
>
> Much easier to write this directly in Lua than in C (see the
> lua-users.org link in an earlier post)