lua-users home
lua-l archive

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

On 1/7/11, steve donovan <> wrote:
> On Fri, Jan 7, 2011 at 9:07 AM, GrayFace <> 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
after all?

joao lobato