lua-users home
lua-l archive

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


>>> 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.
>
>It’s no easier or harder for a user to use a C function vs a Lua function.
>It is, however, quite a bit easier to implement these things in Lua.  Doing it in C is messy.

If it's implemented in Lua, it requires the users to call `require`
function before invoking the deep copy function.
It seems an extra work for the users. Is there any method to avoid
this operation?

Best regards

On Fri, Jan 22, 2021 at 9:43 AM Peter Loveday <peter@loveday.org> wrote:
>
>
> > On 22 Jan 2021, at 11:31, 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
> >
> >> 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.
>
> It’s no easier or harder for a user to use a C function vs a Lua function.
>
> It is, however, quite a bit easier to implement these things in Lua.  Doing it in C is messy.
>
> - Peter