Some changes for panic correctness, stack usage correctness, and speed

This commit is contained in:
kyren
2018-02-12 13:42:13 -05:00
parent c4b3170e2b
commit c22aae461b
8 changed files with 34 additions and 36 deletions
+5 -1
View File
@@ -72,7 +72,11 @@ impl<'lua> String<'lua> {
stack_guard(lua.state, 0, || {
check_stack(lua.state, 1);
lua.push_ref(lua.state, &self.0);
assert_eq!(ffi::lua_type(lua.state, -1), ffi::LUA_TSTRING);
lua_internal_assert!(
lua.state,
ffi::lua_type(lua.state, -1) == ffi::LUA_TSTRING,
"string ref is not string type"
);
let mut size = 0;
// This will not trigger a 'm' error, because the reference is guaranteed to be of