[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Modern Lua binding library
- From: Coda Highland <chighland@...>
- Date: Mon, 14 Mar 2016 14:47:16 -0700
On Mon, Mar 14, 2016 at 2:22 PM, Jonathan Goble <jcgoble3@gmail.com> wrote:
> On Mon, Mar 14, 2016 at 5:06 PM, ThePhD <jm3689@columbia.edu> wrote:
>> Dear Everyone,
>>
>> [long rant]
>
> I agree. Although I've not dug into it much, and not tried to write
> any code for it, I prefer Python's C API over Lua's, because Python
> defines a `PyObject *` pointer that can be used to point to an
> arbitrary Python value, without need for complicated stack operations.
> And building on that, Python functions written in C receive their
> positional arguments as a `PyObject *` tuple passed directly as an
> actual argument to the C function. (The method of unpacking that tuple
> into C values is a bit clunky, but in my uneducated opinion, worth the
> trade-off.)
>
> I'd love to see something similar to that for Lua.
>
I built something that approximates that as long as the value stays on
the stack or in the registry (and can copy the value into the registry
if it needs it but ONLY if it does). It was super nice... but I don't
have that code anymore because I wrote it for a former employer.
/s/ Adam