[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table.maxn...
- From: Tim Hill <drtimhill@...>
- Date: Mon, 1 Jun 2015 12:54:37 -0700
> On Jun 1, 2015, at 5:25 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>
> 2015-06-01 12:06 GMT+02:00 Tim Hill <drtimhill@gmail.com>:
>
>> 1. Scan the array part of the table (1 to some arbitrary N). If any entry is
>> nil, return false now; it’s not a sequence.
>
> If "some arbitrary N" means "the current size of the array part", N will
> in current implementation (ltable.c) always be a power of 2 such that
> at least half the slots are in use. In other words, up to half the slots
> may be nil. You can only conclude it is not a sequence if an entry is nil
> but some later entry is not.
>
True .. serves me right for posting late at night. It’s a simple fix of course, you walk backwards from the end of the table.
—Tim