lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Looking deeper into this I see that there is an extra step being
> performed in the OP_CALL that may not be done by luaD_call():
> 
>         if (luaD_precall(L, ra, nresults)) {  /* C function? */
>           if (nresults >= 0) L->top = ci->top;  /* adjust results */
> 
> If I understand correctly - this is because following a call to C
> function L->top is set to the first result from the C function, but
> here L->top must be reset to the top of the stack for current
> function. Am I correct in my understanding?

Yes (but see note about the case nresults<0 in lopcodes.h).

-- Roberto