[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Wiping a table in C
- From: Kevin Martin <kev82@...>
- Date: Tue, 11 Feb 2014 13:28:53 +0000
Hi,
The documentation for lua_next refers me to next, which says
"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."
Does this mean I can do
//Assume there is a table at index 1
lua_pushnil(l);
while(lua_next(l, 1) != 0) {
lua_pop(l, 1);
lua_pushvalue(l, -1);
lua_pushnil(l);
lua_settable(l, 1);
}
Thanks,
Kevin