mirror of https://github.com/rusefi/lua.git
default state (created by `luaL_newstate´) has a default panic function
This commit is contained in:
parent
2d8b099274
commit
fe8c365281
14
lauxlib.c
14
lauxlib.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lauxlib.c,v 1.120 2004/07/09 18:23:17 roberto Exp roberto $
|
** $Id: lauxlib.c,v 1.121 2004/07/13 20:11:32 roberto Exp roberto $
|
||||||
** Auxiliary functions for building Lua libraries
|
** Auxiliary functions for building Lua libraries
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -656,7 +656,15 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LUALIB_API lua_State *luaL_newstate (void) {
|
static int panic (lua_State *L) {
|
||||||
return lua_newstate(l_alloc, NULL);
|
fprintf(stderr, "PANIC: unprotected error during Lua-API call\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LUALIB_API lua_State *luaL_newstate (void) {
|
||||||
|
lua_State *L = lua_newstate(l_alloc, NULL);
|
||||||
|
lua_atpanic(L, &panic);
|
||||||
|
return L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue