LuaD: creating a flexible data filter system

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 17 05:50:47 PDT 2015


On Saturday, 17 October 2015 at 02:02:16 UTC, Jakob Ovrum wrote:
> On Friday, 16 October 2015 at 10:45:52 UTC, Chris wrote:
>> Later you call the function with the Lua C API like 
>> "lua_pcall(L, 0, 1, 0);". It's a bit tricky to move things 
>> around on the Lua stack, but you'll get there! ;)
>
> Or you could use LuaD which doesn't require you to mess around 
> with the relatively unproductive, bug-prone C API :)

I've used both, LuaD and DerelictLua + my own smaller D library 
that wraps all these nasty Lua stack operations (e.g. creating, 
accessing and adding to tables). The better I got to know the Lua 
C API while writing my own wrappers, the more I came to 
appreciate LuaD :-) However, LuaD is still 5.1 and I didn't want 
to be stuck with 5.1. So I rolled my own. It's not as 
comprehensive as LuaD but did the trick.

The purpose was to experiment with Lua server pages + vibe.d 
which worked fine. Rikki gave me the idea to compile each page as 
a Lua function into memory for faster execution (etLua style[1]). 
It works fine with both LuaD and my own wrappers. In my own 
version I use the Lua C API directly in some places, though I 
don't know, if that's really a big speedup.

If I set up my own homepage, I'd probably give vibe.d + Lua a 
shot. No more PHP and sh*t like that.

[1] https://github.com/leafo/etlua


More information about the Digitalmars-d-learn mailing list