summaryrefslogtreecommitdiff
path: root/src/ldo.c
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2010-01-14 12:00:00 +0000
committerrepogen <>2010-01-14 12:00:00 +0000
commitecd48c2901f08a88db32139b97c35c59eba1f19e (patch)
tree526e8dac3e037de0024b37c89fa3150baeea969f /src/ldo.c
parent22912c77c80f8de8f7accd3319c726f7c5349fd3 (diff)
downloadlua-github-5.2.0-work2.tar.gz
Lua 5.2.0-work25.2.0-work2
Diffstat (limited to 'src/ldo.c')
-rw-r--r--src/ldo.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ldo.c b/src/ldo.c
index 555113d3..4890ce21 100644
--- a/src/ldo.c
+++ b/src/ldo.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldo.c,v 2.79 2009/12/22 15:32:50 roberto Exp $
+** $Id: ldo.c,v 2.80 2010/01/13 16:17:32 roberto Exp $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -554,8 +554,12 @@ LUA_API int lua_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction k) {
luai_userstateyield(L, nresults);
lua_lock(L);
api_checknelems(L, nresults);
- if (L->nny > 0)
- luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");
+ if (L->nny > 0) {
+ if (L != G(L)->mainthread)
+ luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");
+ else
+ luaG_runerror(L, "attempt to yield from outside a coroutine");
+ }
L->status = LUA_YIELD;
if (isLua(ci)) { /* inside a hook? */
api_check(L, k == NULL, "hooks cannot continue after yielding");