[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.2 Length Operator and tables (bug?)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 18 Apr 2012 09:25:52 +0200
> The problem with that implementation of the # operator is that some people
> rely on the fact that t[#t+1] is always nil to add elements to the table
This is documented behaviour for Lua 5.1 but not for Lua 5.2.
Numerous previous semi-ignorant posts on this list provoked
the Lua team to remove that information from the specification.
A lose-lose non-solution, caused by threads just like this one.
Heck, people, the Lua team has gone out of their way to
solve the #t issue by providing the __len metamethod:
if you don't like #t as supplied, you can change it to anything
you like. Don't talk about it, do it.
But Roberto, if you are still reading this thread (in your place
I would have blacklisted it long ago): you may as well bring
back the t[#t+1]==nil property into the documentation. Its
absence is clearly not sufficient to stop people from
yammering about the length function.
- References:
- Re: Lua 5.2 Length Operator and tables (bug?), Dirk Laurie
- Re: Lua 5.2 Length Operator and tables (bug?), Robert Virding
- Re: Lua 5.2 Length Operator and tables (bug?), Coda Highland
- Re: Lua 5.2 Length Operator and tables (bug?), Joseph Manning
- Re: Lua 5.2 Length Operator and tables (bug?), Coda Highland
- Re: Lua 5.2 Length Operator and tables (bug?), Dirk Laurie
- Re: Lua 5.2 Length Operator and tables (bug?), Coda Highland
- Re: Lua 5.2 Length Operator and tables (bug?), joao lobato
- Re: Lua 5.2 Length Operator and tables (bug?), Coda Highland
- Re: Lua 5.2 Length Operator and tables (bug?), joao lobato
- Re: Lua 5.2 Length Operator and tables (bug?), Eduardo Ochs
- RE: Lua 5.2 Length Operator and tables (bug?), Alexandre Rion