summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/ldo.c b/ldo.c
index 15766e21..9ae6a116 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.195 2002/10/08 18:46:08 roberto Exp roberto $ 2** $Id: ldo.c,v 1.196 2002/10/09 13:42:01 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -343,16 +343,22 @@ LUA_API int lua_resume (lua_State *L, lua_State *co) {
343 int status; 343 int status;
344 lua_lock(L); 344 lua_lock(L);
345 ci = co->ci; 345 ci = co->ci;
346 if (ci == co->base_ci) /* no activation record? ?? */ 346 if (ci == co->base_ci) { /* no activation record? ?? */
347 luaG_runerror(L, "cannot resume dead thread"); 347 luaO_pushfstring(L, "cannot resume dead thread");
348 if (co->errorJmp != NULL) /* ?? */ 348 status = LUA_ERRRUN;
349 luaG_runerror(L, "cannot resume active thread"); 349 }
350 status = luaD_rawrunprotected(co, resume, &numres); 350 else if (co->errorJmp != NULL) { /* ?? */
351 if (status == 0) 351 luaO_pushfstring(L, "cannot resume active thread");
352 move_results(L, co->top - numres, co->top); 352 status = LUA_ERRRUN;
353 }
353 else { 354 else {
354 setobj(L->top++, co->top - 1); /* move error message to other stack */ 355 status = luaD_rawrunprotected(co, resume, &numres);
355 co->ci = co->base_ci; /* `kill' thread */ 356 if (status == 0)
357 move_results(L, co->top - numres, co->top);
358 else {
359 setobj(L->top++, co->top - 1); /* move error message to other stack */
360 co->ci = co->base_ci; /* `kill' thread */
361 }
356 } 362 }
357 lua_unlock(L); 363 lua_unlock(L);
358 return status; 364 return status;