[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Some small requests for the next release
- From: crow <crow_64a@...>
- Date: Thu, 24 Feb 2005 18:24:38 -0000
Mike Pall <firstname.lastname@example.org> wrote:
>> nt wrote:
>> > 2) Perhaps I am missing something, but there does not appear to be a
>> > convenient way to determine if a table is empty.
>> if not next(t) then ... end
>Oops. Make that:
>if next(t) == nil then ... end
>[false is a valid key.]
I think those two statements work the same.
(I'm open to correction..)
Even so, I think they will only work till the next nil element in the table, There could be something beyond that point, and this wouldn't test for it.
Nor would getn, as that also works up to the first nil, unless explicitly set to a table size you tel it to be.
The way I'd solve this is to avoid having gaps in a table unless I had specific reasons for them, and knowing those reasons, to code specifically for them.
I'm out of my depth, with the subjects I've seen discussed here, but I might as well try to contribute if I think I can. >:)