| 270 | |
| 271 | |
| 272 | void luaT_adjustvarargs (lua_State *L, CallInfo *ci, const Proto *p) { |
| 273 | int totalargs = cast_int(L->top.p - ci->func.p) - 1; |
| 274 | int nfixparams = p->numparams; |
| 275 | int nextra = totalargs - nfixparams; /* number of extra arguments */ |
| 276 | if (p->flag & PF_VATAB) { /* does it need a vararg table? */ |
| 277 | lua_assert(!(p->flag & PF_VAHID)); |
| 278 | createvarargtab(L, ci->func.p + nfixparams + 1, nextra); |
| 279 | /* move table to proper place (last parameter) */ |
| 280 | setobjs2s(L, ci->func.p + nfixparams + 1, L->top.p - 1); |
| 281 | } |
| 282 | else { /* no table */ |
| 283 | lua_assert(p->flag & PF_VAHID); |
| 284 | buildhiddenargs(L, ci, p, totalargs, nfixparams, nextra); |
| 285 | /* set vararg parameter to nil */ |
| 286 | setnilvalue(s2v(ci->func.p + nfixparams + 1)); |
| 287 | lua_assert(L->top.p <= ci->top.p && ci->top.p <= L->stack_last.p); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | |
| 292 | void luaT_getvararg (CallInfo *ci, StkId ra, TValue *rc) { |
no test coverage detected