lua-users home
lua-l archive

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


2014/1/21 Thijs Schreijer <thijs@thijsschreijer.nl>:

> This line;
> table.insert({}, 2, false)
>
> Works fine up to Lua 5.2.1, but fails on 5.2.2.

It never worked, it just failed to throw an error.

> Was there a particular reason for this change?
>
> I didn't see anything in the changes section of the manual nor
> could find anything in the list of patches between 5.2.1 and 5.2.2.
>
> So why was it changed?

Basically because the undefined, implementation-dependent
behaviour of table.insert({}, pos, val) or table.remove(tbl,pos)
when pos is out of range has been mysterious to users,
as attested to by numerous posts to this list.

Checking that pos lies in the permitted range merely brings the
implementation more tightly in line with the specs and therefore
counts as a bug correction, within the scope of a minor release.

There was some discussion on the list, starting from:

<http://lua-users.org/lists/lua-l/2013-02/msg00570.html>