aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lvm.c b/lvm.c
index 16e01d68..e4b1903e 100644
--- a/lvm.c
+++ b/lvm.c
@@ -847,10 +847,19 @@ void luaV_finishOp (lua_State *L) {
847 luaV_concat(L, total); /* concat them (may yield again) */ 847 luaV_concat(L, total); /* concat them (may yield again) */
848 break; 848 break;
849 } 849 }
850 case OP_CLOSE: case OP_RETURN: { /* yielded closing variables */ 850 case OP_CLOSE: { /* yielded closing variables */
851 ci->u.l.savedpc--; /* repeat instruction to close other vars. */ 851 ci->u.l.savedpc--; /* repeat instruction to close other vars. */
852 break; 852 break;
853 } 853 }
854 case OP_RETURN: { /* yielded closing variables */
855 StkId ra = base + GETARG_A(inst);
856 /* adjust top to signal correct number of returns, in case the
857 return is "up to top" ('isIT') */
858 L->top = ra + ci->u2.nres;
859 /* repeat instruction to close other vars. and complete the return */
860 ci->u.l.savedpc--;
861 break;
862 }
854 default: { 863 default: {
855 /* only these other opcodes can yield */ 864 /* only these other opcodes can yield */
856 lua_assert(op == OP_TFORCALL || op == OP_CALL || 865 lua_assert(op == OP_TFORCALL || op == OP_CALL ||
@@ -1672,6 +1681,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
1672 n = cast_int(L->top - ra); /* get what is available */ 1681 n = cast_int(L->top - ra); /* get what is available */
1673 savepc(ci); 1682 savepc(ci);
1674 if (TESTARG_k(i)) { /* may there be open upvalues? */ 1683 if (TESTARG_k(i)) { /* may there be open upvalues? */
1684 ci->u2.nres = n; /* save number of returns */
1675 if (L->top < ci->top) 1685 if (L->top < ci->top)
1676 L->top = ci->top; 1686 L->top = ci->top;
1677 luaF_close(L, base, CLOSEKTOP, 1); 1687 luaF_close(L, base, CLOSEKTOP, 1);