Update formatting (Lua registry values)

This commit is contained in:
Alex Orlenko 2022-10-17 00:16:52 +01:00
parent 9831d0e397
commit 0354703dbf
No known key found for this signature in database
GPG key ID: 4C150C250863B96D

View file

@ -2101,11 +2101,8 @@ impl Lua {
let _sg = StackGuard::new(self.state);
check_stack(self.state, 1)?;
ffi::lua_rawgeti(
self.state,
ffi::LUA_REGISTRYINDEX,
key.registry_id as Integer,
);
let id = key.registry_id as Integer;
ffi::lua_rawgeti(self.state, ffi::LUA_REGISTRYINDEX, id);
self.pop_value()
};
T::from_lua(value, self)
@ -2151,14 +2148,10 @@ impl Lua {
self.push_value(t)?;
// It must be safe to replace the value without triggering memory error
ffi::lua_rawseti(
self.state,
ffi::LUA_REGISTRYINDEX,
key.registry_id as Integer,
);
Ok(())
let id = key.registry_id as Integer;
ffi::lua_rawseti(self.state, ffi::LUA_REGISTRYINDEX, id);
}
Ok(())
}
/// Returns true if the given `RegistryKey` was created by a `Lua` which shares the underlying