lua-users home
lua-l archive

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


I think as it stands if luaD_poscall() does not leave L->top point to
the top of the results then external callers of luaV_execute() will
not know how many values were returned.


I think luaV_execute() don't need know how many values were returned,
because if the caller need multi results, let luaD_poscall() change the L->top , and the return values are just on the stack top.

In most cases, the number of return values is fixed, luaD_poscall() will put them in the right place. As Roberto said, lua uses a register-based VM, it preallocates "registers" in the stack for return values before OP_CALL .

 I think if you want to create a custom version of luaV_execute() for JIT lua function, you may pass an extra argument for the place of return values in the stack .