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