lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Rici Lake a écrit :
On 20-Sep-06, at 3:55 AM, Philippe Lhoste wrote:
Argh! WOULD BE! I tried it, and wondered by I had syntax errors...

wondered WHY I had syntax errors... :-)

This is the version which works with current Lua (5.1.1):

 > style="native"
 > a = { a = 1,
      b = { b = 2,
            c = ({native = 1, rock = 2})[style] or 0
          }
    }
 > =a.b.c
1

Works also with Lua 5.0, thank you, a very good tip.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --