[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: C API question
- From: joao lobato <btnfdp.lobato@...>
- Date: Fri, 7 Jan 2011 13:59:09 +0000
On 1/7/11, steve donovan <firstname.lastname@example.org> wrote:
> On Fri, Jan 7, 2011 at 9:07 AM, GrayFace <email@example.com> wrote:
>> Sounds messy. Storing values returned by luaL_ref is especially weird.
> Yes, you could end up with a C extension that was actually slower than
> the Lua equivalent.
> Worth thinking about, because LuaJIT changes the game. Straight Lua
> code can actually be faster than a custom C extension.
> steve d.
First of all, thanks for the feedback :)
Yes, it would be silly to implement a C extension slower than the
equivalent Lua, that is one of my concerns (although I haven't reached
the point where I can run benchmarks).
GrayFace suggested I use the object metatable to store the values, but
the point is: how do I retrieve them? Sure, an array uses explicit
keys, but what if I was implementing a RB-tree?
And while I'm at it, what's is the use case of luaL_ref and luaL_unref