aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-19 14:40:17 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-19 14:40:17 -0200
commit4dc0be950ad67e4385400aacd25e10325a2a6e59 (patch)
tree9d201a8d3725f7130740bb574f7e19d8ad3c4d96 /ldo.c
parent3153a41e330a624fccfb7b9ade576767619b4a6b (diff)
downloadlua-4dc0be950ad67e4385400aacd25e10325a2a6e59.tar.gz
lua-4dc0be950ad67e4385400aacd25e10325a2a6e59.tar.bz2
lua-4dc0be950ad67e4385400aacd25e10325a2a6e59.zip
new macro 'isLuacode' (to distinguish regular Lua code from
hooks, where C code can run inside a Lua function).
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ldo.c b/ldo.c
index e58efa52..fa8a382b 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.180 2017/12/12 11:57:30 roberto Exp roberto $ 2** $Id: ldo.c,v 2.181 2017/12/15 13:07:10 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -454,7 +454,7 @@ void luaD_call (lua_State *L, StkId func, int nresults) {
454 ci->func = func; 454 ci->func = func;
455 ci->top = L->top + LUA_MINSTACK; 455 ci->top = L->top + LUA_MINSTACK;
456 lua_assert(ci->top <= L->stack_last); 456 lua_assert(ci->top <= L->stack_last);
457 ci->callstatus = 0; 457 ci->callstatus = CIST_C;
458 if (L->hookmask & LUA_MASKCALL) 458 if (L->hookmask & LUA_MASKCALL)
459 luaD_hook(L, LUA_HOOKCALL, -1); 459 luaD_hook(L, LUA_HOOKCALL, -1);
460 lua_unlock(L); 460 lua_unlock(L);
@@ -479,7 +479,7 @@ void luaD_call (lua_State *L, StkId func, int nresults) {
479 L->top = ci->top = func + 1 + fsize; 479 L->top = ci->top = func + 1 + fsize;
480 lua_assert(ci->top <= L->stack_last); 480 lua_assert(ci->top <= L->stack_last);
481 ci->u.l.savedpc = p->code; /* starting point */ 481 ci->u.l.savedpc = p->code; /* starting point */
482 ci->callstatus = CIST_LUA; 482 ci->callstatus = 0;
483 if (L->hookmask) 483 if (L->hookmask)
484 callhook(L, ci, 0); 484 callhook(L, ci, 0);
485 luaV_execute(L, ci); /* run the function */ 485 luaV_execute(L, ci); /* run the function */
@@ -698,6 +698,7 @@ LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx,
698 } 698 }
699 L->status = LUA_YIELD; 699 L->status = LUA_YIELD;
700 if (isLua(ci)) { /* inside a hook? */ 700 if (isLua(ci)) { /* inside a hook? */
701 lua_assert(!isLuacode(ci));
701 api_check(L, k == NULL, "hooks cannot continue after yielding"); 702 api_check(L, k == NULL, "hooks cannot continue after yielding");
702 ci->u2.nyield = 0; /* no results */ 703 ci->u2.nyield = 0; /* no results */
703 } 704 }