MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / luaB_select

Function luaB_select

lua/lbaselib.c:366–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364
365
366static int luaB_select (lua_State *L) {
367 int n = lua_gettop(L);
368 if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
369 lua_pushinteger(L, n-1);
370 return 1;
371 }
372 else {
373 int i = luaL_checkint(L, 1);
374 if (i < 0) i = n + i;
375 else if (i > n) i = n;
376 luaL_argcheck(L, 1 <= i, 1, "index out of range");
377 return n - i;
378 }
379}
380
381
382static int luaB_pcall (lua_State *L) {

Callers

nothing calls this directly

Calls 3

lua_gettopFunction · 0.85
lua_typeFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected