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

Function sort

third-party/lua-5.3.5/src/ltablib.c:411–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

luaL_checktypeFunction · 0.70
lua_settopFunction · 0.70
auxsortFunction · 0.70

Tested by

no test coverage detected