[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: 孙世龙 sunshilong <sunshilong369@...>
- Date: Fri, 22 Jan 2021 10:55:49 +0800
>I have no idea how you’re including your C functions, whether it’s a loadable module or you’re embedding the interpreter and manually registering them
Embedding the interpreter and manually registering them through
lua_register() function.
>whether you want to have source files visible or include them in a binary
It's better to have the source files invisible to avoid unintended
modification by the users.
-Sunshilong
On Fri, Jan 22, 2021 at 10:02 AM Peter Loveday <peter@loveday.org> wrote:
>
>
>
> > On 22 Jan 2021, at 12:25, 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
> >
> >>>> 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?
>
> Well that’s up to your application/environment choices.
>
> I have no idea how you’re including your C functions, whether it’s a loadable module or you’re embedding the interpreter and manually registering them... but of course you can include Lua functions in similar ways, whether that be via executing a string, a file, a module, or whatever. This may be dependent on how you intend to distribute it, whether you want to have source files visible or include them in a binary...
>
> This is down to how you choose to structure your environment though. Given an appropriate setup, there’s no difference as far as the user is concerned… they shouldn’t need to know if they’re calling C or Lua, ideally.
>
> - Peter
- References:
- Create a new table based on an already existed table (through Lua or C API)?, 孙世龙 sunshilong
- Re: Create a new table based on an already existed table (through Lua or C API)?, Scott Morgan
- Re: Create a new table based on an already existed table (through Lua or C API)?, 孙世龙 sunshilong
- Re: Create a new table based on an already existed table (through Lua or C API)?, Scott Morgan
- Re: Create a new table based on an already existed table (through Lua or C API)?, 孙世龙 sunshilong
- Re: Create a new table based on an already existed table (through Lua or C API)?, Scott Morgan
- Re: Create a new table based on an already existed table (through Lua or C API)?, 孙世龙 sunshilong
- Re: Create a new table based on an already existed table (through Lua or C API)?, Peter Loveday
- Re: Create a new table based on an already existed table (through Lua or C API)?, 孙世龙 sunshilong
- Re: Create a new table based on an already existed table (through Lua or C API)?, Peter Loveday