lua-users home
lua-l archive

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


Cory Bloyd asked:

> What happens when you modify a table while iterating over
> it?

pairs() is implemented with next().  The reference manual
says:

# The behavior of next is undefined if, during the
# traversal, you assign any value to a non-existent field in
# the table.

Assigning values to already existing keys is fine.

-- 
Aaron