diff options
Diffstat (limited to 'lstate.c')
| -rw-r--r-- | lstate.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.c,v 1.95 2002/06/03 14:09:57 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.96 2002/06/06 18:17:33 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 | */ |
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "lua.h" | 8 | #include "lua.h" |
| 9 | 9 | ||
| 10 | #include "ldebug.h" | ||
| 10 | #include "ldo.h" | 11 | #include "ldo.h" |
| 11 | #include "lfunc.h" | 12 | #include "lfunc.h" |
| 12 | #include "lgc.h" | 13 | #include "lgc.h" |
| @@ -122,14 +123,13 @@ LUA_API lua_State *lua_newthread (lua_State *OL) { | |||
| 122 | 123 | ||
| 123 | LUA_API lua_State *lua_open (void) { | 124 | LUA_API lua_State *lua_open (void) { |
| 124 | lua_State *L; | 125 | lua_State *L; |
| 125 | TObject dummy; | 126 | TObject dummy[2]; |
| 126 | setnilvalue(&dummy); | ||
| 127 | L = luaM_new(NULL, lua_State); | 127 | L = luaM_new(NULL, lua_State); |
| 128 | if (L) { /* allocation OK? */ | 128 | if (L) { /* allocation OK? */ |
| 129 | preinit_state(L); | 129 | preinit_state(L); |
| 130 | L->l_G = NULL; | 130 | L->l_G = NULL; |
| 131 | L->next = L->previous = L; | 131 | L->next = L->previous = L; |
| 132 | if (luaD_runprotected(L, f_luaopen, &dummy) != 0) { | 132 | if (luaD_runprotected(L, f_luaopen, dummy) != 0) { |
| 133 | /* memory allocation error: free partial state */ | 133 | /* memory allocation error: free partial state */ |
| 134 | close_state(L); | 134 | close_state(L); |
| 135 | L = NULL; | 135 | L = NULL; |
| @@ -169,8 +169,8 @@ static void close_state (lua_State *L) { | |||
| 169 | 169 | ||
| 170 | 170 | ||
| 171 | LUA_API void lua_closethread (lua_State *L, lua_State *thread) { | 171 | LUA_API void lua_closethread (lua_State *L, lua_State *thread) { |
| 172 | if (L == thread) lua_error(L, "cannot close only thread of a state"); | ||
| 173 | lua_lock(L); | 172 | lua_lock(L); |
| 173 | if (L == thread) luaG_runerror(L, "cannot close only thread of a state"); | ||
| 174 | luaE_closethread(L, thread); | 174 | luaE_closethread(L, thread); |
| 175 | lua_unlock(L); | 175 | lua_unlock(L); |
| 176 | } | 176 | } |
