diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-08-04 15:40:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-08-04 15:40:28 -0300 |
commit | 5e7dbd0b8b397ba8fbeb0698ca051829a683a9d8 (patch) | |
tree | 9f3a8e7714ba687feaa8d435ab848450850830bc | |
parent | cd6c276e412227c57c36679692b93ac57bfd5562 (diff) | |
download | lua-5e7dbd0b8b397ba8fbeb0698ca051829a683a9d8.tar.gz lua-5e7dbd0b8b397ba8fbeb0698ca051829a683a9d8.tar.bz2 lua-5e7dbd0b8b397ba8fbeb0698ca051829a683a9d8.zip |
api checks to ensure that thread is OK when using lua_call/lua_pcall
-rw-r--r-- | lapi.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.132 2010/07/02 17:35:06 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.133 2010/07/25 15:18:19 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -799,6 +799,7 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx, | |||
799 | api_check(L, k == NULL || !isLua(L->ci), | 799 | api_check(L, k == NULL || !isLua(L->ci), |
800 | "cannot use continuations inside hooks"); | 800 | "cannot use continuations inside hooks"); |
801 | api_checknelems(L, nargs+1); | 801 | api_checknelems(L, nargs+1); |
802 | api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); | ||
802 | checkresults(L, nargs, nresults); | 803 | checkresults(L, nargs, nresults); |
803 | func = L->top - (nargs+1); | 804 | func = L->top - (nargs+1); |
804 | if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ | 805 | 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, | |||
839 | api_check(L, k == NULL || !isLua(L->ci), | 840 | api_check(L, k == NULL || !isLua(L->ci), |
840 | "cannot use continuations inside hooks"); | 841 | "cannot use continuations inside hooks"); |
841 | api_checknelems(L, nargs+1); | 842 | api_checknelems(L, nargs+1); |
843 | api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); | ||
842 | checkresults(L, nargs, nresults); | 844 | checkresults(L, nargs, nresults); |
843 | if (errfunc == 0) | 845 | if (errfunc == 0) |
844 | func = 0; | 846 | func = 0; |