5.3 The table library respects __index, i.e. accesses are no longer raw. 5.2.2 Illegal indices to table.insert and table.remove are flagged as errors instead of silently causiing something silly. 5.2 The table library respects __len, and the notion of 'sequence' finds its way into the manual. The word "hole" is not used. 5.1 The word 'length' is used for the result of the new # operator, and the notion of "hole" is used to describe something that "regular arrays" do not have. 5.0 Table manipulation is collected into the 'table' library. The "size" of an array could be some hidden internal register that you can set with 'setn', 4.0 'tinsert' and 'tremove' appear as global functions. The notion of "size" of an array is used, which is either an explicit 'n' field or the number of elements before the first hole (but the word "hole" is not used).
Yes I too have watched it over the years. Personally, I found “setn” was the best so far, since it made length explicit, simple to understand (and also O(1), which was nice). This also aligns with pretty much every other language. However I don’t want to re-open this rats nest again.
—Tim
|