On Mon, 9 Jan 2017 18:22:56 +0000
"Robin H. Johnson" <robb...@orbis-terrarum.net> wrote:

> TL;DR:
> 'end' is a reserved Lua keyword, and cannot be used as a structure
> member as in Map.end. Need to change the naming of constants maybe?
> 
> http://www.arpalert.org/src/haproxy-lua-api/1.7/index.html#map-class
> > -- Create and load map
> > geo = Map.new("geo.map", Map.ip);
> 
> Now if you want to use the match method 'end', the docs say to use
> 'Map.end'.
> 
> This is not legal Lua, because 'end' is a reserved keyword.
> 
> I see two potential ways forward:
> a) Map['end'] # works right now, but ugly
> b) Map.match_end # intent is much clearer


Hi, thank for you comment ! You're absolutely right. This keyword
doesn't run because it is reserved. The good news is that I can change
the API because, obviously, nobody use this keyword :)

I agree, the solution "a" is ugly, but it is working now. I dont like
the solution "b", because the form of the word is different than other.

Maybe "suffix" in place of "end", but I prefer the same word that the
word used in haproxy configs.

I think that I will rename all the match keywords with the prefix
"match_", and keep the old names available, but undocumented for the
backward compatibility.

All the ideas are welcome.

Thierry


> -- 
> Robin Hugh Johnson
> E-Mail     : robb...@orbis-terrarum.net
> Home Page  : http://www.orbis-terrarum.net/?l=people.robbat2
> ICQ#       : 30269588 or 41961639
> GnuPG FP   : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
> 

Reply via email to