mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add lua panic handler
This commit is contained in:
parent
ad1d7477ad
commit
bc7d3abead
1 changed files with 8 additions and 0 deletions
|
|
@ -99,7 +99,15 @@ static void create_libs(State* L, StateType stateType) {
|
|||
addfunc(L, "crc32", lua::wrap<l_crc32>);
|
||||
}
|
||||
|
||||
static int l_panic_handler(lua::State* L) {
|
||||
logger.error() << "PANIC: unprotected error in call to Lua API: " << lua::tostring(L, -1);
|
||||
logger.flush();
|
||||
abort();
|
||||
}
|
||||
|
||||
void lua::init_state(State* L, StateType stateType) {
|
||||
lua_atpanic(L, l_panic_handler);
|
||||
|
||||
// Allowed standard libraries
|
||||
luaL_openlibs(L);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue