MCPcopy Create free account
hub / github.com/PlutoLang/Pluto / luaB_select

Function luaB_select

src/lbaselib.cpp:518–531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516
517
518static int luaB_select (lua_State *L) {
519 int n = lua_gettop(L);
520 if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
521 lua_pushinteger(L, n-1);
522 return 1;
523 }
524 else {
525 lua_Integer i = luaL_checkinteger(L, 1);
526 if (i < 0) i = n + i;
527 else if (i > n) i = n;
528 luaL_argcheck(L, 1 <= i, 1, "index out of range");
529 return n - (int)i;
530 }
531}
532
533
534/*

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