lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Jun 28, 2007, at 22:05, Rici Lake wrote:

<Digression>
If this seems like a reversion to Lua 4 and the old 'n'
field, so be it.... you could use a different key if you liked
</Digression>

And all this so I can finally write:

local HTTP = require( 'HTTP' )

HTTP[ '/hello(.*)' ] = function( aName ) return 'hello ' .. ( aName or 'world' ) .. '!' end
HTTP()

% lua TestHTTP.lua
GET /hello HTTP/1.1

HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: text/html
Content-Length: 12
Etag: fc3ff98e8c6a0d3087d515c0473f8677
Content-Md5: fc3ff98e8c6a0d3087d515c0473f8677
Date: Thu, 28 Jun 2007 20:50:29 GMT

hello world!

Phhhew... :P

http://dev.alt.textdrive.com/browser/HTTP/HTTP.lua#L329