lua-users home
lua-l archive

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


Joshua Jensen wrote:
Perhaps I can do a better job explaining if I actually

understood why
adding the extra (ugly) syntax for basic table iterations

makes Lua a
better language.

As Myke pointed out, this is an old decision. The rationale is that we do not see "pairs" as the "basic table iteration". I, for instance, use ipairs much more frequently than pairs. I believe that is true for many other programmers.

I heard someone mention the possible addition of a "__pairs" or "__iter" metamethod. I don't see such a thing in work6. But that would be a great solution to this problem for my application. Is it being considered?

--
chris marrin                ,""$,
chris@marrin.com          b`    $                             ,,.
                        mP     b'                            , 1$'
        ,.`           ,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"'