[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Definition of a sequence
- From: Mike <lua-l@...>
- Date: Thu, 11 Jun 2015 22:48:08 +0300
On Thu, 11 Jun 2015 16:14:59 +0200
Dirk Laurie <...> wrote:
>
> The rule is implementation-dependent, but the Lua implementation
> has not recently changed.
>
> In the Lua 5.1 manual, the following boundary property was
> guaranteed:
>
> t[#t] is not nil, but t[#t+1] is.
>
> This is no longer documented, perhaps because the user can now
> supply a __len that does not have that property.
>
And there is such a case:
---------
Lua 5.3.0 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> t = {nil, nil, 1, 2, nil, 4, nil, nil, 0, nil}
> =#t
0
> =t[#t]
nil
>
---------
> ...
>
> The difference you observe is caused by different sizes of the
> array part.
>
> ...
Thank you for explanation, Dirk.
--
Mike
- References:
- Definition of a sequence, Dirk Laurie
- Re: Definition of a sequence, Tim Hill
- Re: Definition of a sequence, Dirk Laurie
- Re: Definition of a sequence, Tim Hill
- Re: Definition of a sequence, Dirk Laurie
- Re: Definition of a sequence, Tim Hill
- Re: Definition of a sequence, "书呆彭, Peng Yi"
- Re: Definition of a sequence, Andrew Starks
- Re: Definition of a sequence, Mike
- Re: Definition of a sequence, Dirk Laurie