lua-users home
lua-l archive

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


Leandro Pelorosso wrote:
> Can I add new rows to the table while I iterate over
> all the key-value pairs?
>

Not if you iterate with pairs() (or lua_next):

"The behavior of next is undefined if, during the traversal, you assign
any value to a non-existent field in the table. You may however modify
existing fields. In particular, you may clear existing fields."

(from the Reference Manual)