What I thought was that I need a good syntax for simple sequence table constructors as well. e.g t = {x, y, z}
First try { x, y, z, # } is syntactic sugar for
{ [1] = x, [2] = y, [3] = z, [#] = # }
A simply # in the constructor sets t[#] at the current length (t[#] = #t). I am not sure about it though, as # acts here as an operator and not as a value.
A bigger issue is that Lua makes no guarantees about the order of initializers, so you don’t know what the value of t[#] will be.
—Tim
|