| 255 | |
| 256 | |
| 257 | static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { |
| 258 | int i; |
| 259 | int nfixargs = p->numparams; |
| 260 | StkId base, fixed; |
| 261 | lua_assert(actual >= nfixargs); |
| 262 | /* move fixed parameters to final position */ |
| 263 | luaD_checkstack(L, p->maxstacksize); /* check again for new 'base' */ |
| 264 | fixed = L->top - actual; /* first fixed argument */ |
| 265 | base = L->top; /* final position of first argument */ |
| 266 | for (i=0; i<nfixargs; i++) { |
| 267 | setobjs2s(L, L->top++, fixed + i); |
| 268 | setnilvalue(fixed + i); |
| 269 | } |
| 270 | return base; |
| 271 | } |
| 272 | |
| 273 | |
| 274 | static StkId tryfuncTM (lua_State *L, StkId func) { |