[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pairs(t, skey) and ipairs(t, skey)
- From: Paul K <paulclinger@...>
- Date: Mon, 30 Sep 2013 18:16:45 -0700
Hi Phill,
>> next(t, #t) returns the first key in the hash part (if any).
> This isn't necessarily true. It is possible to set up a table with
> multiple holes in the array part such that next( t, #t ) will return
> an index which still falls in the array.
I wasn't careful in my phrasing of that sentence. Yes, it may return a
key that follows one of the holes, but this is exactly what I'd
need/expect in this case.
For example, using this table, {"a", nil, nil, "f", "g", [7] = {}, [9]
= "i"}, #t gives me 5 (Lua 5.1) and next(t, #t) returns 7.
Paul.