On Sun, 1 Mar 2015 23:20:14 +0100
Baptiste <bed...@gmail.com> wrote:

>  how do you pass arguments to a lua function?
>  Imagine I want to call the following lua function: "function download
> (host, file)"


If you ask about argument between HAProxy configuration file and Lua
function, I assume than my documentation is incomplete.

"converters" and "sample-fetches" can have a maximum of 5 arguments.
All the arguments are strings. If HAProxy, the declaration is like this:

   http-request redirect location %[lua.my_function(arg1, arg2, arg3)]

The Lua declaration is like this:

   function my_function(txn, arg1, arg2, arg3)
      -- do something
   end

The "action" functions can not have arguments.

If you ask about the convention call in Lua, the official
documentation will be more precise than me.

   http://www.lua.org/manual/5.2/manual.html#3.4.9

Thierry


> Baptiste
> 

Reply via email to