Forgotten part of userdata performance optimization for Lua 5.1
This commit is contained in:
parent
9005f32a98
commit
4516ca0bb5
13
src/lua.rs
13
src/lua.rs
|
@ -2822,10 +2822,15 @@ impl Lua {
|
|||
|
||||
// Set empty environment for Lua 5.1
|
||||
#[cfg(any(feature = "lua51", feature = "luajit"))]
|
||||
protect_lua!(self.state, 1, 1, fn(state) {
|
||||
ffi::lua_newtable(state);
|
||||
ffi::lua_setuservalue(state, -2);
|
||||
})?;
|
||||
if protect {
|
||||
protect_lua!(self.state, 1, 1, fn(state) {
|
||||
ffi::lua_newtable(state);
|
||||
ffi::lua_setuservalue(state, -2);
|
||||
})?;
|
||||
} else {
|
||||
ffi::lua_newtable(self.state);
|
||||
ffi::lua_setuservalue(self.state, -2);
|
||||
}
|
||||
|
||||
Ok(AnyUserData(self.pop_ref()))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue