lua-users home
lua-l archive

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


i'm clear, thank for roberto

On Thu, Dec 17, 2015 at 12:10 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> 703     if ((ci->u.c.k = k) != NULL)  /* is there a continuation? */
>
> 704       ci->u.c.ctx = ctx;  /* save context */
>
> 705     ci->func = L->top - nresults - 1;  /* protect stack below results
> */
> 706     luaD_throw(L, LUA_YIELD);
> 707   }
>
> why should protect stack below results, somewhere can change the stack
> value?

'lua_resume' assumes that everything on the stack are results from
yield. 'protect' here means to avoid those values being considered
results to 'resume'.

-- Roberto