The following code:
a = { "a", "b", "c" }
for i, v in a do write(v) end
tremove(a)
for i, v in a do write(v) end
foreach
produces "abcab2" as the result.
Then I checked the Lua manual, "tremove" removes the last element and
then inserts extra field "n = getn(table)". But this makes
the array table into a mapping table. I mean, is this a desirable
behavior? for any good reasons?
Tentatively, I change to foreachi in my programs, but writing extra
anonymous function isn't as clean, as I am forced to use upper values