More aggressively remove code from error_guard

This commit is contained in:
kyren 2017-07-23 10:40:57 -04:00
parent d5ec09614c
commit 91dbbfe759
1 changed files with 8 additions and 7 deletions

View File

@ -229,9 +229,10 @@ impl<'lua> LuaTable<'lua> {
lua.push_value(lua.state, value);
error_guard(lua.state, 3, |state| {
ffi::lua_settable(state, -3);
ffi::lua_pop(state, 1);
Ok(())
})
})?;
ffi::lua_pop(lua.state, 1);
Ok(())
}
}
@ -315,11 +316,11 @@ impl<'lua> LuaTable<'lua> {
unsafe {
check_stack(lua.state, 3);
lua.push_ref(lua.state, &self.0);
error_guard(lua.state, 1, |state| {
let len = ffi::luaL_len(state, -1);
ffi::lua_pop(state, 1);
let len = error_guard(lua.state, 1, |state| {
Ok(ffi::luaL_len(state, -1))
})?;
ffi::lua_pop(lua.state, 1);
Ok(len)
})
}
}