mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
atpanic function was not a good idea, it's not sound
It crosses the C api boundary, the only proper way to panic would be to actually error guard everywhere, aborting is fine.
This commit is contained in:
@@ -659,15 +659,6 @@ impl Lua {
|
||||
pub fn new() -> Lua {
|
||||
unsafe {
|
||||
let state = ffi::luaL_newstate();
|
||||
unsafe extern "C" fn panic_function(state: *mut ffi::lua_State) -> c_int {
|
||||
if let Some(s) = ffi::lua_tostring(state, -1).as_ref() {
|
||||
panic!("rlua - unprotected error in call to Lua API ({})", s)
|
||||
} else {
|
||||
panic!("rlua - unprotected error in call to Lua API <unprintable error>")
|
||||
}
|
||||
}
|
||||
|
||||
ffi::lua_atpanic(state, panic_function);
|
||||
ffi::luaL_openlibs(state);
|
||||
|
||||
stack_guard(state, 0, || {
|
||||
|
||||
Reference in New Issue
Block a user