MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaT_adjustvarargs

Function luaT_adjustvarargs

third-party/lua-5.5.0/src/ltm.c:272–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270
271
272void luaT_adjustvarargs (lua_State *L, CallInfo *ci, const Proto *p) {
273 int totalargs = cast_int(L->top.p - ci->func.p) - 1;
274 int nfixparams = p->numparams;
275 int nextra = totalargs - nfixparams; /* number of extra arguments */
276 if (p->flag & PF_VATAB) { /* does it need a vararg table? */
277 lua_assert(!(p->flag & PF_VAHID));
278 createvarargtab(L, ci->func.p + nfixparams + 1, nextra);
279 /* move table to proper place (last parameter) */
280 setobjs2s(L, ci->func.p + nfixparams + 1, L->top.p - 1);
281 }
282 else { /* no table */
283 lua_assert(p->flag & PF_VAHID);
284 buildhiddenargs(L, ci, p, totalargs, nfixparams, nextra);
285 /* set vararg parameter to nil */
286 setnilvalue(s2v(ci->func.p + nfixparams + 1));
287 lua_assert(L->top.p <= ci->top.p && ci->top.p <= L->stack_last.p);
288 }
289}
290
291
292void luaT_getvararg (CallInfo *ci, StkId ra, TValue *rc) {

Callers 1

luaV_executeFunction · 0.70

Calls 2

createvarargtabFunction · 0.85
buildhiddenargsFunction · 0.85

Tested by

no test coverage detected