On Tue, 8 May 2018 21:26:49 +0200 Baptiste <bed...@gmail.com> wrote: > On Tue, May 8, 2018 at 8:17 PM, Baptiste <bed...@gmail.com> wrote: > > > Hi All, Thierry, > > > > I'm trying to use the converter 'table_http_req_cnt()' from a Lua script, > > but I'm not successful and so I wonder how I'm supposed to use the > > converter class (txn.c:<converter>)... > > > > The documentation misses an example: > > https://www.arpalert.org/src/haproxy-lua-api/1.8/index. > > html#converters-class > > > > Like for the fetches class: > > https://www.arpalert.org/src/haproxy-lua-api/1.8/index.html#fetches-class > > > > Any help would be appreciated. (HAProxy 1.8, HTTP action context, where I > > want to pass a string to the converter table_http_req_cnt to read some > > data from my table). > > > > Baptiste > > > > > Replying to myself with the solution: the sample must be set as the first > argument when calling the converter. > IE: local myvar = txn.c:table_http_req_cnt(<sample>,<table name>) > > Hope this helps.
Hi Baptiste, Lua converters functions are automatically generated from registered haproxy converters, So converters can't have specific documentation. The only one rules are: - The first argument is the input data. - Next arguments are the arguments described in classic HAProxy doc. So, the following HAProxy configuration example: str(test),conv(33) I written like this in Lua: txn.c:conv("test", 33) If you have some useful example, do not hesitate to improve the documentation. BR, Thierry