lua-users home
lua-l archive

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



On Dec 11, 2014, at 3:07 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:

I’ve not tested this, but if ipairs() DOES respect __len() in some way on
5.3 beta, then imho either the code or the docs are wrong.

The change in ipairs from 5.2 is that __index is respected in 5.3-beta.
If __index invokes __len, then __ipairs may depend on __len.

Well obviously, and it would depend on math.sin() if it invoked that. The point is that ipairs() in and of itself does not use # or __len(). I also just checked this in the new rc0 beta source. My point for the OP was that ipairs() is therefore no longer equivalent to a for loop that uses #t as an upper limit.

—Tim