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:
parent
b3218137e1
commit
9aed99e3e3
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rlua"
|
name = "rlua"
|
||||||
version = "0.4.4"
|
version = "0.4.5"
|
||||||
authors = ["kyren <catherine@chucklefish.org>"]
|
authors = ["kyren <catherine@chucklefish.org>"]
|
||||||
description = "High level bindings to Lua 5.3"
|
description = "High level bindings to Lua 5.3"
|
||||||
repository = "https://github.com/chucklefish/rlua"
|
repository = "https://github.com/chucklefish/rlua"
|
||||||
|
|
|
@ -659,15 +659,6 @@ impl Lua {
|
||||||
pub fn new() -> Lua {
|
pub fn new() -> Lua {
|
||||||
unsafe {
|
unsafe {
|
||||||
let state = ffi::luaL_newstate();
|
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);
|
ffi::luaL_openlibs(state);
|
||||||
|
|
||||||
stack_guard(state, 0, || {
|
stack_guard(state, 0, || {
|
||||||
|
|
Loading…
Reference in New Issue