Documentation about how to write a FastCGI application can be found on the
FastCGI website [www.fastcgi.com]. How to configure Hiawatha to use such application can be found on the
CGI and FastCGI HOWTO page.
You can use
this example C source file [www.hiawatha-webserver.org] to learn how to write your own FastCGI application. I don't know much about lua, but I'm sure that it can be used to write a CGI application. On the
Kepler wikipedia page [en.wikipedia.org] you can see that it supports FastCGI, so that should also be no problem.