aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-08-13 16:52:53 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-08-13 16:52:53 -0300
commitfe8c365281f0f23f24ea79357296b8b9c91b7fdb (patch)
tree725aed125e83a0a256c2d192639ad8dbb94455ba
parent2d8b099274699286eed4ebe8a45900de1b28a398 (diff)
downloadlua-fe8c365281f0f23f24ea79357296b8b9c91b7fdb.tar.gz
lua-fe8c365281f0f23f24ea79357296b8b9c91b7fdb.tar.bz2
lua-fe8c365281f0f23f24ea79357296b8b9c91b7fdb.zip
default state (created by `luaL_newstate´) has a default panic function
-rw-r--r--lauxlib.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lauxlib.c b/lauxlib.c
index ae18348c..83bae2e4 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -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
659static int panic (lua_State *L) {
660 fprintf(stderr, "PANIC: unprotected error during Lua-API call\n");
661 return 0;
662}
663
664
659LUALIB_API lua_State *luaL_newstate (void) { 665LUALIB_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