Re: Create a new table based on an already existed table (through Lua or C API)?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Create a new table based on an already existed table (through Lua or C API)?
- From: Peter Loveday <peter@...>
- Date: 2021年1月22日 12:12:35 +1030
> 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