lua-users home
lua-l archive

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


On Mon, Mar 14, 2016 at 5:47 PM, Coda Highland <chighland@gmail.com> wrote:
> 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

Thanks for confirming that it's possible as a meta-library. If I ever
get some more free time, I may look into implementing it, but that
won't happen anytime soon.