[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug in 5.3 ipairs(), or feature?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 5 Mar 2015 09:24:51 +0200
2015-03-05 9:18 GMT+02:00 Tom N Harris <telliamed@whoopdedo.org>:
> On Thursday, March 05, 2015 08:53:03 AM Dirk Laurie wrote:
>> Lua 5.3.0 Copyright (C) 1994-2015 Lua.org, PUC-Rio
>>
>> > a={1}
>> > for k,v in ipairs(a) do
>>
>> a[k+1]=k+1
>> print(a[k])
>> if k==5 then break end
>> end
>
> Which also "accidentally" works if you use pairs instead.
The reason for that is quite deep and cannot in general
be relied on if there has been a lot of activity in the table.