| 291 | |
| 292 | |
| 293 | static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { |
| 294 | int i; |
| 295 | int nfixargs = p->numparams; |
| 296 | StkId base, fixed; |
| 297 | /* move fixed parameters to final position */ |
| 298 | fixed = L->top - actual; /* first fixed argument */ |
| 299 | base = L->top; /* final position of first argument */ |
| 300 | for (i = 0; i < nfixargs && i < actual; i++) { |
| 301 | setobjs2s(L, L->top++, fixed + i); |
| 302 | setnilvalue(fixed + i); /* erase original copy (for GC) */ |
| 303 | } |
| 304 | for (; i < nfixargs; i++) |
| 305 | setnilvalue(L->top++); /* complete missing arguments */ |
| 306 | return base; |
| 307 | } |
| 308 | |
| 309 | |
| 310 | /* |