lua-users home
lua-l archive

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


> Read the old thread for a bunch of suggestions. I'd rather
> have an append operator (t[] = x) than a size/length operator.

But then you need an append operator, a "last" operator (that gets the
contents of the last element in your list), plus a remove operator.
With *t you get all of them (plus the length itself):

  t[*t+1] = x    -- append
  print(t[*t])   -- last element
  t[*t] = nil    -- remove

-- Roberto