diff options
| -rw-r--r-- | lauxlib.c | 7 |
1 files changed, 4 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.136 2005/05/31 14:31:50 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.137 2005/05/31 14:34:02 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 | */ |
| @@ -682,14 +682,15 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { | |||
| 682 | 682 | ||
| 683 | static int panic (lua_State *L) { | 683 | static int panic (lua_State *L) { |
| 684 | (void)L; /* to avoid warnings */ | 684 | (void)L; /* to avoid warnings */ |
| 685 | fprintf(stderr, "PANIC: unprotected error during Lua-API call\n"); | 685 | fprintf(stderr, "PANIC: unprotected error during Lua-API call (%s)\n", |
| 686 | lua_tostring(L, -1)); | ||
| 686 | return 0; | 687 | return 0; |
| 687 | } | 688 | } |
| 688 | 689 | ||
| 689 | 690 | ||
| 690 | LUALIB_API lua_State *luaL_newstate (void) { | 691 | LUALIB_API lua_State *luaL_newstate (void) { |
| 691 | lua_State *L = lua_newstate(l_alloc, NULL); | 692 | lua_State *L = lua_newstate(l_alloc, NULL); |
| 692 | lua_atpanic(L, &panic); | 693 | if (L) lua_atpanic(L, &panic); |
| 693 | return L; | 694 | return L; |
| 694 | } | 695 | } |
| 695 | 696 | ||
