lua-users home
lua-l archive

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


Stefan Brantschen wrote:
Daniel
I do not understand your point. Isn't Shmuel's code

  t = {}
  table.insert(t, "a")
  t[1] = nil
  print (table.getn(t))

perfectly correct Lua, including the usage of the table lib?

Stefan,
I was wrong in that this behavior wasn't in accordance with 5.0 docs.
It was.
(table.insert is apparently supposed to work in pair with table.remove,
"manually" removing the elements makes table.getn results "incorrect".)

However in my 2-nd example (where table.concat throws an error),
it's obviously using table.getn internally, but the docs seem to
not mention that.

--
Shmuel