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

Function luaB_select

third-party/lua-5.5.0/src/lbaselib.c:448–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446
447
448static int luaB_select (lua_State *L) {
449 int n = lua_gettop(L);
450 if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
451 lua_pushinteger(L, n-1);
452 return 1;
453 }
454 else {
455 lua_Integer i = luaL_checkinteger(L, 1);
456 if (i < 0) i = n + i;
457 else if (i > n) i = n;
458 luaL_argcheck(L, 1 <= i, 1, "index out of range");
459 return n - (int)i;
460 }
461}
462
463
464/*

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.70
lua_typeFunction · 0.70
lua_pushintegerFunction · 0.70
luaL_checkintegerFunction · 0.70

Tested by

no test coverage detected