Today I tried to use mod_lua
in httpd.conf
LoadModule lua_module modules/mod_lua.so
AddHandler lua-script .lua
I putted the example.lua into my htdocs folder. But than I get a 500 error.
[Sat Nov 27 20:57:20.544939 2010] [lua:crit] [pid 1424:tid 616] [client 127.0.0.1:50542] lua: Unable to find function handle in C:/Apache2x/htdocs/example.lua, referer: http://localhost/
How to use mod_lua ??
Hi Mario,
I've been to busy with everything else to even begin to think about looking at that module. Considering I have never seen any LUA code, I'm not sure where to begin. However, now that there is a docs page for it, it looks interesting.
It does seem to work.
http://www.apachehaus.net/info.zip
try that script, outputs like phpinfo()
Indeed that works. There is might an error in that other example. Now I have a new toy! Only need to learn lua :D
my first working lua script.
function handle(r)
-- setup the environment
r.content_type = "text/html"
--r.headers_out["X-Powered-By"] = "mod_lua; " .. _VERSION
print = function(s) return r:write(tostring(s)) end
r:puts("Hi!")
print("Hi!")
-- finish
return apache2.OK
end
---- edit ---
every syntax error causing a 500 error is pretty anoying!
Hi!Hi!
Welcome to my world, Perl does same :D
Does that code run unchaged on perl??
no, I was just saying if you are writing in perl, the slightest syntax error will cause a 500.