We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Table::clear
1 parent 40b507c commit bad2037Copy full SHA for bad2037
src/table.rs
@@ -416,14 +416,7 @@ impl Table {
416
417
lua.push_ref(&self.0);
418
419
- // Clear array part
420
- for i in 1..=ffi::lua_rawlen(state, -1) {
421
- ffi::lua_pushnil(state);
422
- ffi::lua_rawseti(state, -2, i as Integer);
423
- }
424
-
425
- // Clear hash part
426
- // It must be safe as long as we don't use invalid keys
+ // This is safe as long as we don't assign new keys
427
ffi::lua_pushnil(state);
428
while ffi::lua_next(state, -2) != 0 {
429
ffi::lua_pop(state, 1); // pop value
0 commit comments