[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [Xavante] site example doesn't work
- From: Tom <tom.wieland@...>
- Date: Sun, 30 May 2010 20:19:06 +0200
Hello.
When I recently was configuring Xavante to run an orbit app I found
that the example configuration posted on the site doesn't work with
the current Xavante API.
The code mentioned is:
{ -- cgiluahandler example
match = {"%.lp$", "%.lp/.*$", "%.lua$", "%.lua/.*$" },
with = xavante.cgiluahandler.makeHandler (webDir)
},
which should be
{ -- cgiluahandler example
match = {"%.lp$", "%.lp/.*$", "%.lua$", "%.lua/.*$" },
with = xavante.cgiluahandler.makeHandler (webDir, {})
},
The error I got:
...m/.luarocks/share/lua/5.1//xavante/cgiluahandler.lua:37: attempt to
index local 'params' (a nil value)
With the definition of the function that the line belongs to of:
function makeHandler (diskpath, params)
params = setmetatable({ modname = params.modname or "wsapi.sapi",
bootstrap = bootstrap }, { __index = params or {} })
local sapi_loader = wsapi.common.make_isolated_launcher(params)
return wsapi.xavante.makeHandler(sapi_loader, nil, diskpath)
end
makes me suggest to write it as:
function makeHandler (diskpath, params)
params = params or {}
params = setmetatable({ modname = params.modname or "wsapi.sapi",
bootstrap = bootstrap }, { __index = params or {} })
local sapi_loader = wsapi.common.make_isolated_launcher(params)
return wsapi.xavante.makeHandler(sapi_loader, nil, diskpath)
end
Or would this be considered bad coding practice?
gr,
Tom Wieland