lua-users home
lua-l archive

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


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)