MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / luaB_select

Function luaB_select

libraries/AP_Scripting/lua/src/lbaselib.c:388–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386
387
388static int luaB_select (lua_State *L) {
389 int n = lua_gettop(L);
390 if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
391 lua_pushinteger(L, n-1);
392 return 1;
393 }
394 else {
395 lua_Integer i = luaL_checkinteger(L, 1);
396 if (i < 0) i = n + i;
397 else if (i > n) i = n;
398 luaL_argcheck(L, 1 <= i, 1, "index out of range");
399 return n - (int)i;
400 }
401}
402
403
404/*

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