|
My view of this is simple; a sequence is the Lua equivalent of an array (or as near as it gets to one). Other languages have survived for decades only allowing positive integral indices in arrays, why is it a problem in Lua? If you have non-integral numeric keys, you don’t have an array; you have a dictionary with arbitrary keys that happen to be numeric. The # operator is pretty meaningless in this case. If you really have need for a set of data items indexed by integer keys (an array), and an additional set of *different* data items with non-integral keys, imho you are better off keeping these in discrete tables (perhaps inside a top-level table); segregating data by clever tricks with the data domains is always messy in my experience. —Tim |