lua-users home
lua-l archive

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


2012/9/18 Dirk Laurie <dirk.laurie@gmail.com>:
>>
>> Good, thanks for the suggestion. But doing this naturally with be even
>> better :).
>>
>
> At present, if you write " in tbl" it means at the very
> least that you did not at that moment consciously decide whether it
> should be "pairs" or "ipairs".

Well, if I use a single var, "for v in tbl", I mean ipairs because I
don't need an extra var for the keys, they are easily recoverable if
needed - for normal Lua list tables starting at 1. That doesn't happen
with map tables, I need the extra var to correlate keys and values.

>  In order to ensure that such inattention
> is in fact correct, you should have consciously assigned an appropriate
> metamethod to __call.  This is sane behaviour which I would not like
> to see sacrificed.

But I see your point, though.

I'm not asking for any change in Lua, I'm quite happy with the way it
is. I just would be happier if I could use "for v in t" naturally, but
the metamethod way is fine with me.

-- 
Fidelis Assis