lua-users home
lua-l archive

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


On 5 August 2015 at 21:12, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
>>> When 'b' is zero, this return must return all values on the stack
>>> (e.g., 'return ...', and L->top must be kept for the next instruction
>>> (after the OP_CALL to where we are returning) to know how many
>>> results the function have (see next answer).
>>>
>>> It happens when the function that called the one being returned needs
>>> multiple returns. As I explained, in that case L->top limits the
>>> number of values being returned, and will be corrected by the
>>> instruction following the OP_CALL (see comments in 'lopcdes.h').
>>>
> I see that 'b' is being used to determine how many results to return
> in above, but in OP_RETURN, 'L->top' is immediately reset so is it
> correct to say that 'L->top' must be kept for the next instruction
> after the OP_CALL?
>

My bad - 'L->top' is reset when 'b' is not 0, so it is not immediately reset.

Regards