On 19 January 2018 at 21:26, Elias Hogstvedt
<eliashogstvedt@gmail.com> wrote:
table.makesequence(t, 6) -- equivalent to t._SEQ = 6
-- now table functions respect the _SEQ field if (and only if) it is present
for i, v in ipairs(t) print(v) end -- a b nil nil e f
t:makesequence(8)
for i, v in ipairs(t) print(v) end -- a b nil nil e f nil nil
t:insert(5, "X") -- table.insert increments _SEQ, table.remove decrements it
for i, v in ipairs(t) print(v) end -- a b nil nil X e f nil nil
print(#t) -- 9 (__len first checks _SEQ)