Check that lua_newstate() returns non-null Lua state

This commit is contained in:
Alex Orlenko 2022-08-01 12:56:36 +01:00
parent ab029b087d
commit ee32dc33f3
No known key found for this signature in database
GPG key ID: 4C150C250863B96D

View file

@ -443,6 +443,7 @@ impl Lua {
} else {
(ffi::luaL_newstate(), ptr::null_mut())
};
assert!(!state.is_null(), "Failed to instantiate Lua VM");
ffi::luaL_requiref(state, cstr!("_G"), ffi::luaopen_base, 1);
ffi::lua_pop(state, 1);