lua-users home
lua-l archive

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

On 26 July 2012 12:41, Carsten Fuchs <> wrote:
> Dear Lua list,
> using Lua 5.1, when I loop over the key-value pairs in a table using
> lua_next(), it is safe to modify the values?
> Especially if the new value is nil, in order to remove the key-value pair
> from the table?
> explicitly warns about
> modifying the keys, but says nothing about modifying the values.

You can modify the values, including setting them to nil. The only
other thing you *can't* do is add new keys to the table. The
documentation for next() in the manual describes this a bit further.