MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / luaB_unpack

Function luaB_unpack

Source/Misc/lua/src/lua.c:11206–11219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11204
11205
11206static int luaB_unpack (lua_State *L) {
11207int i, e, n;
11208luaL_checktype(L, 1, LUA_TTABLE);
11209i = luaL_optint(L, 2, 1);
11210e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));
11211if (i > e) return 0; /* empty range */
11212n = e - i + 1; /* number of elements */
11213if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
11214return luaL_error(L, "too many results to unpack");
11215lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */
11216while (i++ < e) /* push arg[i + 1...e] */
11217lua_rawgeti(L, 1, i);
11218return n;
11219}
11220
11221
11222static int luaB_select (lua_State *L) {

Callers

nothing calls this directly

Calls 5

luaL_checktypeFunction · 0.85
luaL_getnFunction · 0.85
lua_checkstackFunction · 0.85
luaL_errorFunction · 0.85
lua_rawgetiFunction · 0.85

Tested by

no test coverage detected