| 325 | |
| 326 | |
| 327 | static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { |
| 328 | int i; |
| 329 | int nfixargs = p->numparams; |
| 330 | StkId base, fixed; |
| 331 | lua_assert(actual >= nfixargs); |
| 332 | /* move fixed parameters to final position */ |
| 333 | luaD_checkstack(L, p->maxstacksize); /* check again for new 'base' */ |
| 334 | fixed = L->top - actual; /* first fixed argument */ |
| 335 | base = L->top; /* final position of first argument */ |
| 336 | for (i=0; i<nfixargs; i++) { |
| 337 | setobjs2s(L, L->top++, fixed + i); |
| 338 | setnilvalue(fixed + i); |
| 339 | } |
| 340 | return base; |
| 341 | } |
| 342 | |
| 343 | |
| 344 | static StkId tryfuncTM (lua_State *L, StkId func) { |