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

Function sort

libraries/AP_Scripting/lua/src/ltablib.c:415–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413
414
415static int sort (lua_State *L) {
416 lua_Integer n = aux_getn(L, 1, TAB_RW);
417 if (n > 1) { /* non-trivial interval? */
418 luaL_argcheck(L, n < INT_MAX, 1, "array too big");
419 if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */
420 luaL_checktype(L, 2, LUA_TFUNCTION); /* must be a function */
421 lua_settop(L, 2); /* make sure there are two arguments */
422 auxsort(L, 1, (IdxT)n, 0);
423 }
424 return 0;
425}
426
427/* }====================================================== */
428

Callers

nothing calls this directly

Calls 3

luaL_checktypeFunction · 0.85
lua_settopFunction · 0.85
auxsortFunction · 0.85

Tested by

no test coverage detected