|
|
||
|
On 19-Sep-06, at 11:45 AM, Grellier, Thierry wrote:So, I would prefer to be able to write something like (VHDL flavor, and yet another even more disturbing keyword :-) knowing that if elseif... could be reused) style = "native" a = { a = 1, b = { b = 2, c = 1 when style == "native", 2 when style == "rock", 0 else } }
I actually like "when" (although i use it with "otherwise" because "else" is already in use).
But more Lua like would be:
a = { a = 1, b = { b = 2, c = {native = 1, rock = 2}[style] or 0 } }
-- Philippe Lhoste -- (near) Paris -- France -- http://Phi.Lho.free.fr -- -- -- -- -- -- -- -- -- -- -- -- -- --