lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 27 September 2013 09:05, Michal Kolodziejczyk <> wrote:
That is because you cannot remove elements from the table while
iterating it with pairs() loop, because the order is then undefined.

The order is already undefined with pairs and you are allowed to remove (or as the manual says 'clear') or modify elements during an iteration, what is not defined is to add new elements. The manual makes no special case for using table.remove.

Having said that I have to wonder why the OP would want to remove the last index rather than the index which is the current iteration, this seems like a typo.