Let's say I have a sequence:
a = { 10, 12, 13 }
The length (#a
) of this sequence is 3.
Now, suppose I do the following:
table.insert(a, nil)
(or a[#a+1] = nil
.)
Will this affect the table in any way?
Is the answer to this question decisive, or is this "undefined behavior"?
On the Luas I've checked (Lua 5.1, Lua 5.3) this does not affect the table. But I wonder if this is "undefined behavior" on which I cannot rely.
The manual only talks about adding a nil
to the middle of a sequence, but it doesn't (according to my interpretation) talk about adding it to the end of the sequence.