On Sat, Nov 27, 2010 at 09:28:21PM +0100, Johannes Hofmann wrote:
What's that lua-dpi?
It's a small C program that embeds the Lua interpreter and extends its state with a global function called "dpi". I implemented "dpi" by modifying the main() function of the hello DPI filter in the Dillo source. Once lua-dpi has set up the Lua state it takes its first argument as the name of a Lua script which it loads and runs.
Can we have a look at it?
It's a patch to the Dillo source. I'm attaching it. I have made it minimally intrusive: the code is in a new directory called dpi/lua and the only changes to existing files are one-liner changes to dpi/Makefile.am (to make the build recurse into the lua subdirectory) and configure.in (to create dpi/lua/Makefile). NB: I have renamed the dpi to "lua" instead of "starurchin", so the URL is now "dpi:/lua/". Also, if you install Dillo to a prefix other than "/usr" you will have to change the #! line of lua.filter.dpi to match (that's a bug that I will fix if this project gets serious). The current API is much too simple to do anything non-trivial. I think the final version will look more like this: dpi(function (request) url = request.url; html = ...; request:reply(html); end); Regards, Jeremy Henty