An array is more than a table deliberately limited to consecutive integer keys. This is a sequence, a set of n elements (not key-value pairs, only values) with a clearly defined order. This, in my opinion, is a data structure that does not have a place for additional data in the form of non-integer keys. This is conceptually simpler.
In addition, implementing the two separately may be easier, especially when considering adding optimizations (which is apparently not well understood that a performance-oriented language such as Lua has not implemented it for many years), which makes arrays well-executed.
In addition, the point of flexibility is debatable. If a need arises for a more complex annotation, it is possible that you will also need polymorphism, in which case you just need to switch to objects with an array among other attributes.
delnan
source share