diff options
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.120 2004/07/09 18:23:17 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.121 2004/07/13 20:11:32 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -656,7 +656,15 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { | |||
656 | } | 656 | } |
657 | 657 | ||
658 | 658 | ||
659 | static int panic (lua_State *L) { | ||
660 | fprintf(stderr, "PANIC: unprotected error during Lua-API call\n"); | ||
661 | return 0; | ||
662 | } | ||
663 | |||
664 | |||
659 | LUALIB_API lua_State *luaL_newstate (void) { | 665 | LUALIB_API lua_State *luaL_newstate (void) { |
660 | return lua_newstate(l_alloc, NULL); | 666 | lua_State *L = lua_newstate(l_alloc, NULL); |
667 | lua_atpanic(L, &panic); | ||
668 | return L; | ||
661 | } | 669 | } |
662 | 670 | ||