lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Thu, Apr 19, 2012 at 3:17 PM, Dirk Laurie <> wrote:
> The definition says "the set of its positive numeric keys is equal to
> {1..n} for some integer n."  So that test returns false too easily.
> E.g.
>> a=table.pack(1,2,3,4)
>> =IsSequence(a)
> false
> Actually, if the purpose is to define when #t and the table library
> work, the definition should say: "the set of its positive integer
> numeric keys is empty or equal to {1..n} for some positive integer n."

0 is an integer, and when n is 0 we have {1,...,n} = {}.
By the way,

  a = {10, 20, 30, 40, foo="bar",
       [0]="z", [-2.5]=99, [-250]="!"}

is a sequence - according to the manual =) - but if we do a[6]=60
the result isn't a sequence anymore.

    Eduardo Ochs