On 2 September 2011 09:48, Peter Pimley <[email protected]> wrote:
>
> How can I connect such a function to Xavante?
>
For the sake of anybody in the future arriving at this query via a
search, the answer is:
{
match = -- whatever,
with = wsapi.xavante.makeHandler(my_wsapi_function),
}
It's important that the table does not have a 'params' entry, as that
alters the way in which the 'with' field is interpreted. See the
function _buildRules in xavante.lua:
1. If 'with' is a function and the rule does not contain a 'params'
value, then the 'with' function is the handler. (as in the example
above)
2. If 'with' is a function and the rule does contain a 'params' value,
then the 'with' function is called, passing in the params. The
returned function is the handler.
3. If 'with' is a module, then the module’s 'makeHandler' function is
called, passing in the rule’s 'params' value (or nil). The returned
function is the handler.
Given clause 3 above, it's a pity that wsapi.xavante.makeHandler
doesn't take a single table holding the various parameters.
Is there a way to get round this? I'd love to be able to write
something like the following:
{
match = --whatever,
with = wsapi.xavante,
params = {app_func = my_wsapi_function},
}
_______________________________________________
Kepler-Project mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/