Re: Modifying a table while iterating over it?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Modifying a table while iterating over it?
- From: "Aaron Brown" <aaron-lua@...>
- Date: 2005年9月22日 12:56:31 -0400
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