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

Function getnumargs

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

** Get the number of extra arguments in a vararg function. If vararg ** table has been optimized away, that number is in the call info. ** Otherwise, get the field 'n' from the vararg table and check that it ** has a proper value (non-negative integer not larger than the stack ** limit). */

Source from the content-addressed store, hash-verified

319** limit).
320*/
321static int getnumargs (lua_State *L, CallInfo *ci, Table *h) {
322 if (h == NULL) /* no vararg table? */
323 return ci->u.l.nextraargs;
324 else {
325 TValue res;
326 if (luaH_getshortstr(h, luaS_new(L, "n"), &res) != LUA_VNUMINT ||
327 l_castS2U(ivalue(&res)) > cast_uint(INT_MAX/2))
328 luaG_runerror(L, "vararg table has no proper 'n'");
329 return cast_int(ivalue(&res));
330 }
331}
332
333
334/*

Callers 1

luaT_getvarargsFunction · 0.85

Calls 3

luaH_getshortstrFunction · 0.70
luaS_newFunction · 0.70
luaG_runerrorFunction · 0.70

Tested by

no test coverage detected