[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (alpha) now available
- From: Philipp Janda <siffiejoe@...>
- Date: Fri, 01 Aug 2014 09:41:58 +0200
Hi!
Am 31.07.2014 20:30 schröbte Luiz Henrique de Figueiredo:
Lua 5.3.0 (alpha) is now available for testing at
http://www.lua.org/work/lua-5.3.0-alpha.tar.gz
All feedback welcome. Thanks.
--lhf
I think I spotted a formatting error in the manual (`id{__ipairs}` in
the "Changes in the Libraries" section).
I really like that many table operations now respect metamethods, but
now starts the complaining:
Is there a reason why the protocol for `ipairs` has changed from
"iterate to first nil value" to "iterate to #table"? The first is well
defined for all tables, and runs in O(n), while the second needs
O(nlog(n)) time, requires a proper sequence for defined behavior, or can
yield nil values during iteration.
If this behavior is going to stay, I also think the metamethod check can
be simplified to
lua_CFunction iter =
(luaL_getmetafield(L, 1, "__len"))
? ipairsaux : ipairsaux_raw;
I.e. `__index` will never trigger unless there is a hole in the table in
which case you need `__len` as well for the iteration to have defined
behavior.
Philipp