[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A review of changes between 5.1 and 5.2-work3
- From: Duncan Cross <duncan.cross@...>
- Date: Thu, 20 May 2010 18:21:13 +0100
On Thu, May 20, 2010 at 4:38 PM, Peter Cawley <lua@corsix.org> wrote:
> To help understand all of the changes between Lua 5.1(.4) and Lua
> 5.2-work3, I took I diff of the source folders of the two, then
> distilled the resulting 16000 line diff line into an easier to read
> blog post. You may be interested in reading the result (and feedback
> is also welcomed):
>
> http://www.corsix.org/content/look-lua-52-work3
>
Very neat - thanks!
"Note that even with deprecation of ipairs disabled, the behaviour of
ipairs differs in 5.2-work3 from that of 5.1; specifically, it
respects the length operator (...)"
As Roberto pointed out [1], it only refers to the length operator when
it's on a nil value, so in certain (probably unlikely) circumstances
it actually won't fully respect the length operator:
> a = setmetatable({}, {__len = function() return 3; end})
> for i,v in ipairs(a) do print(i,v); end
1 nil
2 nil
3 nil
> a[4] = true
> for i,v in ipairs(a) do print(i,v); end
1 nil
2 nil
3 nil
4 true
[1] http://lua-users.org/lists/lua-l/2010-05/msg00342.html
-Duncan