d'Arc 0.2.0

Fast Lua Sub API

More
Jeanne
Benchmarks
Implementation
Source

Online Home
License
Repository


Cave Ab Homine Unius Libri

This is a very slim sub API for classic Lua and LuaJIT. It reaches below the official Lua API to get to the quick faster, and often needs less memory. It helps bridging the divide opening up between the PUC and JIT VMs, beyond what's granted in form of the official API, by the powers that be. d'Arc can be used to make libraries for both Lua and LuaJIT faster, and makes it easier to write patches that target both Lua and LuaJIT.

d'Arc allows you to use direct (cost-less) C pointers to variable contents, in a clear and unified way. Write once, works for both Lua and LuaJIT.

Sample

char *s = XLUA_STRING(variable);

Plus, you get to traverse tables much faster, in both Lua and LuaJIT. Effectively by giving you a fold wrapper for a callback.

if(XLUA_IS_TABLE(variable))
        darc_traverse(XLUA_TABLE(variable), my_callback, my_state);

I know, nothing is supposed to be faster than light these days. But any entangled photon can do the trick. While the world is watching. It's really faster than the JIT API.

Download

git clone git://github.com/hdiedrich/darc.git darc

This sub API is mainly for reading, not for altering variables. For that, you'd keep using the official API. d'Arc works for Lua 5.1 and JIT 2.0. There will be 5.2 support.

Mortal Dangers

d'Arc will have to be adapted to new releases of Lua or LuaJIT. So if you rely on it - and you are really lame - you may get awfully stuck in the future and die.

Unless you feel able to understand 50 lines of C code, that is. To adapt d'Arc yourself if the spit hits the pan. Which is really what this project is about: to get you started exploring the ground floor of Lua and LuaJIT. Because Lua is so small and concise, using it the way d'Arc invites you to, can quickly become as addictive as Lua itself. The VMs are programs, too. Make them your own. Learn from the geniuses. Your understanding and use of Lua will only benefit.

Also note that not using d'Arc is not in itself a guarantee that you will not die. And if you find it, will you send me the URL where it says that the official Lua API will never change?

© 2011 Henning Diedrich