MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaB_select

Function luaB_select

lib/lua/src/lbaselib.c:438–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436
437
438static int luaB_select (lua_State *L) {
439 int n = lua_gettop(L);
440 if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
441 lua_pushinteger(L, n-1);
442 return 1;
443 }
444 else {
445 lua_Integer i = luaL_checkinteger(L, 1);
446 if (i < 0) i = n + i;
447 else if (i > n) i = n;
448 luaL_argcheck(L, 1 <= i, 1, "index out of range");
449 return n - (int)i;
450 }
451}
452
453
454/*

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.85
lua_typeFunction · 0.85
lua_pushintegerFunction · 0.85
luaL_checkintegerFunction · 0.85

Tested by

no test coverage detected