MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaB_select

Function luaB_select

extlibs/lua/src/lbaselib.c:416–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414
415
416static int luaB_select (lua_State *L) {
417 int n = lua_gettop(L);
418 if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
419 lua_pushinteger(L, n-1);
420 return 1;
421 }
422 else {
423 lua_Integer i = luaL_checkinteger(L, 1);
424 if (i < 0) i = n + i;
425 else if (i > n) i = n;
426 luaL_argcheck(L, 1 <= i, 1, "index out of range");
427 return n - (int)i;
428 }
429}
430
431
432/*

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