mirror of https://github.com/rusefi/lua.git
api checks to ensure that thread is OK when using lua_call/lua_pcall
This commit is contained in:
parent
cd6c276e41
commit
5e7dbd0b8b
4
lapi.c
4
lapi.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 2.132 2010/07/02 17:35:06 roberto Exp roberto $
|
** $Id: lapi.c,v 2.133 2010/07/25 15:18:19 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -799,6 +799,7 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx,
|
||||||
api_check(L, k == NULL || !isLua(L->ci),
|
api_check(L, k == NULL || !isLua(L->ci),
|
||||||
"cannot use continuations inside hooks");
|
"cannot use continuations inside hooks");
|
||||||
api_checknelems(L, nargs+1);
|
api_checknelems(L, nargs+1);
|
||||||
|
api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
|
||||||
checkresults(L, nargs, nresults);
|
checkresults(L, nargs, nresults);
|
||||||
func = L->top - (nargs+1);
|
func = L->top - (nargs+1);
|
||||||
if (k != NULL && L->nny == 0) { /* need to prepare continuation? */
|
if (k != NULL && L->nny == 0) { /* need to prepare continuation? */
|
||||||
|
@ -839,6 +840,7 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
|
||||||
api_check(L, k == NULL || !isLua(L->ci),
|
api_check(L, k == NULL || !isLua(L->ci),
|
||||||
"cannot use continuations inside hooks");
|
"cannot use continuations inside hooks");
|
||||||
api_checknelems(L, nargs+1);
|
api_checknelems(L, nargs+1);
|
||||||
|
api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
|
||||||
checkresults(L, nargs, nresults);
|
checkresults(L, nargs, nresults);
|
||||||
if (errfunc == 0)
|
if (errfunc == 0)
|
||||||
func = 0;
|
func = 0;
|
||||||
|
|
Loading…
Reference in New Issue