lua-users home
lua-l archive

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


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