Programming and Scripting :: lighttpd lua query string access

anyone familiar with lighttpd using lua scripts ?

i'm trying to call a lua script by supplying a query string in a link ;

<a href="goto_date.lua?31-3-2008">1</a>

but don't know how to get to the query string argument(s)

arg[0] only holds the program path
arg[1] is nil

how do i get the date ?  ???

Not sure I understand if this is based on user input or parsing some date variable. Try this yet?

It's an environment variable

Try os.getenv("QUERY_STRING")

Here's an example I have in one of my in-progress cgi scripts
Code Sample
-- break up query string
params=" "..string.gsub(os.getenv("QUERY_STRING"),"&"," ").." "

function get_param(var)
local p=string.gsub(params,".*"..var.."=(.-)%s.*","%1")
-- strip any naughty leading path


This particular function breaks up a string that uses the format
The lua script would end up setting var_a="something" and var_b="somethingelse"

tks mikshaw, that's just what i was looking for.
mikshaw wrote:
Here's an example I have in one of my in-progress cgi scripts

Just curious, did the existing cgi.lua not work for you?

We have had cgi.lua together with sample lua scripts for monkey webserver since before murgaLua.

Next Page...
original here.