diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-16 14:08:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-16 14:08:28 -0300 |
commit | c11d374c592d10b8ed649ffe501191039ee18757 (patch) | |
tree | 52a3b434d6197ae36c7f132b370c9807251effe0 /lstate.c | |
parent | 13230c451ba2feaef1c92c391451ee6471b15bb7 (diff) | |
download | lua-c11d374c592d10b8ed649ffe501191039ee18757.tar.gz lua-c11d374c592d10b8ed649ffe501191039ee18757.tar.bz2 lua-c11d374c592d10b8ed649ffe501191039ee18757.zip |
`panic' function configurable via API
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 1.87 2002/03/11 12:45:00 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.88 2002/03/20 12:52:32 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -25,6 +25,16 @@ | |||
25 | static void close_state (lua_State *L); | 25 | static void close_state (lua_State *L); |
26 | 26 | ||
27 | 27 | ||
28 | /* | ||
29 | ** you can change this function through the official API | ||
30 | ** call `lua_setpanicf' | ||
31 | */ | ||
32 | static int default_panic (lua_State *L) { | ||
33 | fprintf(stderr, "unable to recover; exiting\n"); | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | |||
28 | static void stack_init (lua_State *L, lua_State *OL) { | 38 | static void stack_init (lua_State *L, lua_State *OL) { |
29 | L->stack = luaM_newvector(OL, BASIC_STACK_SIZE, TObject); | 39 | L->stack = luaM_newvector(OL, BASIC_STACK_SIZE, TObject); |
30 | L->stacksize = BASIC_STACK_SIZE; | 40 | L->stacksize = BASIC_STACK_SIZE; |
@@ -52,6 +62,7 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
52 | G(L)->strt.hash = NULL; | 62 | G(L)->strt.hash = NULL; |
53 | G(L)->Mbuffer = NULL; | 63 | G(L)->Mbuffer = NULL; |
54 | G(L)->Mbuffsize = 0; | 64 | G(L)->Mbuffsize = 0; |
65 | G(L)->panic = &default_panic; | ||
55 | G(L)->rootproto = NULL; | 66 | G(L)->rootproto = NULL; |
56 | G(L)->rootcl = NULL; | 67 | G(L)->rootcl = NULL; |
57 | G(L)->roottable = NULL; | 68 | G(L)->roottable = NULL; |