Re: Table length evaluations --> Lua 5.5 vs. Lua 5.4
Błażej Roszkowski <[email protected]>
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <CAOc0etHokkAP6W7xkrqevtRX+Vn2eVGMFqUCbj4ohiPd5DY_VA@mail.gmail.com> |
The comment in ltable.c line 1291 above luaH_getn: ** Try to find a border in table 't'. (A 'border' is an integer index ** such that t[i] is present and t[i+1] is absent, or 0 if t[1] is absent, ** or 'maxinteger' if t[maxinteger] is present.) The "or 0 if t[1] is absent" makes it sound like it took precedence over the first definition. OTOH the documentation is correct and even mentions if there's more than one border (non-sequence table) then any can be returned. On Sun, 15 Feb 2026 at 15:48, Luther Thompson <[email protected]> wrote: > On 2/15/26 07:04, Błażej Roszkowski wrote: > > It seems there are still bugs. Comment in C source says "or 0 if t[1] > > is absent" but > > for {nil, 1, 1, 1} the # yields 4 (due to *lenhint being 2 so 1 is > > never checked). > > I don't know where that comment is, but if it's like the documentation > at https://www.lua.org/manual/5.5/manual.html#3.4.7, it's merely part of > the definition of a border. Since the # result can be any border, it > won't always be 0 if there are other borders in the table. > > Luther > > -- > You received this message because you are subscribed to the Google Groups > "lua-l" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/lua-l/2b9ef29a-a816-40dd-b758-afe01c07ca07%40gmail.com > . > -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAOc0etHokkAP6W7xkrqevtRX%2BVn2eVGMFqUCbj4ohiPd5DY_VA%40mail.gmail.com.