lua-users home
lua-l archive

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

	Hi Javier,

On Wed, 15 Dec 2004, Javier Guerra wrote:
> right, of course; what i'll try is something like this:
> function setupurlfunctions ()
>  local uf = {}
>  function lfhandler (path)
>   local f = uf [path]
>   if (f) then
>    return f()
>   end
>  end
>  function registerurlfunction (path, f)
>   uf [path] = f
>  end
>  cgilua.addscripthandler ("lf", lfhandler)
> end
> in other words, a very simple extension handler would do the url=>function
> association
	There is subtle trick you might pay attention.  Despite
the launcher you choose, CGILua always run from the beginning,
therefore, unless you decide to change the internal structure,
you will have to put the above code inside cgilua/config.lua.
This way, the code will be executed before CGILua decides what
handler to call.  Also you will have to register all the functions
there, for the same reason.

> maybe i would modify the fastcgi launcher to get rid of the venv() for each
> call... i still feel that it negates most of the advantages of the persistent
> state of fastCGI
	You can do that but be careful because CGILua expects to
run in a clean environment.