new macro 'isLuacode' (to distinguish regular Lua code from

hooks, where C code can run inside a Lua function).
This commit is contained in:
Roberto Ierusalimschy
2017-12-19 14:40:17 -02:00
parent 3153a41e33
commit 4dc0be950a
4 changed files with 16 additions and 11 deletions

6
ltm.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: ltm.c,v 2.52 2017/12/13 18:32:09 roberto Exp roberto $
** $Id: ltm.c,v 2.53 2017/12/15 13:07:10 roberto Exp roberto $
** Tag methods
** See Copyright Notice in lua.h
*/
@@ -108,7 +108,7 @@ void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1,
setobj2s(L, func + 3, p3); /* 3rd argument */
L->top += 4;
/* metamethod may yield only when called from Lua code */
if (isLua(L->ci))
if (isLuacode(L->ci))
luaD_call(L, func, 0);
else
luaD_callnoyield(L, func, 0);
@@ -124,7 +124,7 @@ void luaT_callTMres (lua_State *L, const TValue *f, const TValue *p1,
setobj2s(L, func + 2, p2); /* 2nd argument */
L->top += 3;
/* metamethod may yield only when called from Lua code */
if (isLua(L->ci))
if (isLuacode(L->ci))
luaD_call(L, func, 1);
else
luaD_callnoyield(L, func, 1);