|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
-** $Id: ldo.c,v 2.87 2010/05/05 18:49:56 roberto Exp roberto $
|
|
|
+** $Id: ldo.c,v 2.88 2010/06/04 13:06:15 roberto Exp roberto $
|
|
|
** Stack and Call structure of Lua
|
|
|
** See Copyright Notice in lua.h
|
|
|
*/
|
|
@@ -299,7 +299,6 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
|
|
|
if (!ttisfunction(func)) /* `func' is not a function? */
|
|
|
func = tryfuncTM(L, func); /* check the `function' tag method */
|
|
|
funcr = savestack(L, func);
|
|
|
- L->ci->nresults = nresults;
|
|
|
if (ttislcf(func)) { /* light C function? */
|
|
|
f = fvalue(func); /* get it */
|
|
|
goto isCfunc; /* go to call it */
|
|
@@ -312,6 +311,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
|
|
|
isCfunc: /* call C function 'f' */
|
|
|
luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
|
|
|
ci = next_ci(L); /* now 'enter' new function */
|
|
|
+ ci->nresults = nresults;
|
|
|
ci->func = restorestack(L, funcr);
|
|
|
ci->top = L->top + LUA_MINSTACK;
|
|
|
lua_assert(ci->top <= L->stack_last);
|
|
@@ -341,6 +341,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
|
|
|
else /* vararg function */
|
|
|
base = adjust_varargs(L, p, nargs);
|
|
|
ci = next_ci(L); /* now 'enter' new function */
|
|
|
+ ci->nresults = nresults;
|
|
|
ci->func = func;
|
|
|
ci->u.l.base = base;
|
|
|
ci->top = base + p->maxstacksize;
|
|
@@ -368,8 +369,8 @@ int luaD_poscall (lua_State *L, StkId firstResult) {
|
|
|
L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */
|
|
|
}
|
|
|
res = ci->func; /* res == final position of 1st result */
|
|
|
- L->ci = ci = ci->previous; /* back to caller */
|
|
|
wanted = ci->nresults;
|
|
|
+ L->ci = ci = ci->previous; /* back to caller */
|
|
|
/* move results to correct place */
|
|
|
for (i = wanted; i != 0 && firstResult < L->top; i--)
|
|
|
setobjs2s(L, res++, firstResult++);
|