| 256 | |
| 257 | |
| 258 | void luaT_getvarargs (lua_State *L, CallInfo *ci, StkId where, int wanted) { |
| 259 | int i; |
| 260 | int nextra = ci->u.l.nextraargs; |
| 261 | if (wanted < 0) { |
| 262 | wanted = nextra; /* get all extra arguments available */ |
| 263 | checkstackGCp(L, nextra, where); /* ensure stack space */ |
| 264 | L->top.p = where + nextra; /* next instruction will need top */ |
| 265 | } |
| 266 | for (i = 0; i < wanted && i < nextra; i++) |
| 267 | setobjs2s(L, where + i, ci->func.p - nextra + i); |
| 268 | for (; i < wanted; i++) /* complete required results with nil */ |
| 269 | setnilvalue(s2v(where + i)); |
| 270 | } |
| 271 | |