The Apache Haus Forum

Advanced search  

News:

Welcome to Apache Haus Distribution Forum

Pages: [1]   Go Down

Author Topic: mod_lua  (Read 4581 times)

mario

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 580
mod_lua
« on: November 27, 2010, 09:08:12 PM »

Today I tried to use mod_lua

in httpd.conf
Code: [Select]
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.

Code: [Select]
[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 ??
Logged

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 839
Re: mod_lua
« Reply #1 on: November 27, 2010, 11:08:40 PM »

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.
Logged

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 839
Re: mod_lua
« Reply #2 on: November 28, 2010, 08:28:13 PM »

It does seem to work.

http://www.apachehaus.net/info.zip

try that script, outputs like phpinfo()
Logged

mario

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 580
Re: mod_lua
« Reply #3 on: November 29, 2010, 03:22:10 PM »

Indeed that works. There is might an error in that other example. Now I have a new toy! Only need to learn lua :D
Logged

mario

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 580
Re: mod_lua
« Reply #4 on: November 29, 2010, 04:43:30 PM »

my first working lua script.

Code: [Select]
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!
« Last Edit: November 29, 2010, 07:59:10 PM by mario »
Logged

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 839
Re: mod_lua
« Reply #5 on: November 29, 2010, 11:43:29 PM »

Hi!Hi!

Welcome to my world, Perl does same  :D
Logged

mario

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 580
Re: mod_lua
« Reply #6 on: November 30, 2010, 10:19:31 AM »

Does that code run unchaged on perl??
Logged

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 839
Re: mod_lua
« Reply #7 on: November 30, 2010, 05:07:57 PM »

no, I was just saying if you are writing in perl, the slightest syntax error will cause a 500.
Logged
Pages: [1]   Go Up
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13