lua-users home
lua-l archive

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


Pavol Severa wrote:
there is probably nothing as funny as suggestions from a newbie - so
here is one:

if I got it right, an expression like t[1,2,3] is a syntax error.

would you find it reasonable if instead, whenever it meets a
comma-separated list as an index, lua would try to call the __index
(or __newindex) method of the metatable?

This WILL happen if you do this:

    t[{1,2,3}]

--
chris marrin                ,""$,
chris@marrin.com          b`    $                             ,,.
(650) 941-9040          mP     b'                            , 1$'
M1      ,.`           ,b`    ,`                              :$$'
     ,|`             mP    ,`                                       ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'