summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ldo.c b/ldo.c
index 66f89036..f282a773 100644
--- a/ldo.c
+++ b/ldo.c
@@ -388,9 +388,10 @@ static void rethook (lua_State *L, CallInfo *ci, int nres) {
** an error if there is no '__call' metafield.
*/
StkId luaD_tryfuncTM (lua_State *L, StkId func) {
- const TValue *tm = luaT_gettmbyobj(L, s2v(func), TM_CALL);
+ const TValue *tm;
StkId p;
checkstackGCp(L, 1, func); /* space for metamethod */
+ tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); /* (after previous GC) */
if (l_unlikely(ttisnil(tm)))
luaG_callerror(L, s2v(func)); /* nothing to call */
for (p = L->top; p > func; p--) /* open space for metamethod */