diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.51 2005/08/10 20:20:13 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.52 2005/08/22 18:54:49 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -763,13 +763,19 @@ void luaV_execute (lua_State *L, int nexeccalls) { | |||
763 | CallInfo *ci = L->ci; | 763 | CallInfo *ci = L->ci; |
764 | int n = cast(int, ci->base - ci->func) - cl->p->numparams - 1; | 764 | int n = cast(int, ci->base - ci->func) - cl->p->numparams - 1; |
765 | if (b == LUA_MULTRET) { | 765 | if (b == LUA_MULTRET) { |
766 | Protect(luaD_checkstack(L, n)); | ||
767 | ra = RA(i); /* previous call may change the stack */ | ||
766 | b = n; | 768 | b = n; |
767 | L->top = ra + n; | 769 | L->top = ra + n; |
768 | } | 770 | } |
769 | for (j=0; j<b && j<n; j++) | 771 | for (j = 0; j < b; j++) { |
770 | setobjs2s(L, ra+j, ci->base - n + j); | 772 | if (j < n) { |
771 | for (; j<b; j++) | 773 | setobjs2s(L, ra + j, ci->base - n + j); |
772 | setnilvalue(ra+j); | 774 | } |
775 | else { | ||
776 | setnilvalue(ra + j); | ||
777 | } | ||
778 | } | ||
773 | continue; | 779 | continue; |
774 | } | 780 | } |
775 | } | 781 | } |