MCPcopy Create free account
hub / github.com/DFHack/dfhack / adjust_varargs

Function adjust_varargs

depends/lua/src/ldo.c:293–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291
292
293static 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/*

Callers 1

luaD_precallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected