[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pairs(t, skey) and ipairs(t, skey)
- From: Robert Virding <robert.virding@...>
- Date: Sun, 6 Oct 2013 00:32:43 +0200 (CEST)
Sorry if this suggestion has already been made but the thread is getting long.
Wouldn't the easiest solution be for #t just to return largest integer index of the table? Ipairs would just continue working as before. The problem of holes would be solved, they are legal in the table.
Robert
----- Original Message -----
> From: "Javier Guerra Giraldez" <javier@guerrag.com>
> To: "Lua mailing list" <lua-l@lists.lua.org>
> Sent: Friday, 4 October, 2013 4:24:42 PM
> Subject: Re: pairs(t, skey) and ipairs(t, skey)
>
> On Fri, Oct 4, 2013 at 9:21 AM, Schmidt, Phil <PSchmidt@watlow.com> wrote:
> >> a[3]=nil
>
>
> there you're creating a hole, so it's no longer a sequence, and the
> statement isn't aplicable.
>
> "a sequence has no holes" means: "if it has holes, it's not a sequence"
>
> --
> Javier
>
>
- References:
- Re: pairs(t, skey) and ipairs(t, skey), Roberto Ierusalimschy
- Re: pairs(t, skey) and ipairs(t, skey), Leo Razoumov
- Re: pairs(t, skey) and ipairs(t, skey), Luiz Henrique de Figueiredo
- Re: pairs(t, skey) and ipairs(t, skey), Tim Hill
- Re: pairs(t, skey) and ipairs(t, skey), Luiz Henrique de Figueiredo
- RE: pairs(t, skey) and ipairs(t, skey), Schmidt, Phil
- Re: pairs(t, skey) and ipairs(t, skey), Javier Guerra Giraldez