mirror of https://github.com/rusefi/lua.git
correct error message when yielding from outside a coroutine
This commit is contained in:
parent
900b7d4514
commit
0c7de97d47
10
ldo.c
10
ldo.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: ldo.c,v 2.78 2009/12/17 12:28:57 roberto Exp roberto $
|
** $Id: ldo.c,v 2.79 2009/12/22 15:32:50 roberto Exp roberto $
|
||||||
** Stack and Call structure of Lua
|
** Stack and Call structure of Lua
|
||||||
** See Copyright Notice in lua.h
|
** 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);
|
luai_userstateyield(L, nresults);
|
||||||
lua_lock(L);
|
lua_lock(L);
|
||||||
api_checknelems(L, nresults);
|
api_checknelems(L, nresults);
|
||||||
if (L->nny > 0)
|
if (L->nny > 0) {
|
||||||
luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");
|
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;
|
L->status = LUA_YIELD;
|
||||||
if (isLua(ci)) { /* inside a hook? */
|
if (isLua(ci)) { /* inside a hook? */
|
||||||
api_check(L, k == NULL, "hooks cannot continue after yielding");
|
api_check(L, k == NULL, "hooks cannot continue after yielding");
|
||||||
|
|
Loading…
Reference in New Issue