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

Function sort

third-party/lua-5.4.6/src/ltablib.c:399–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397
398
399static int sort (lua_State *L) {
400 lua_Integer n = aux_getn(L, 1, TAB_RW);
401 if (n > 1) { /* non-trivial interval? */
402 luaL_argcheck(L, n < INT_MAX, 1, "array too big");
403 if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */
404 luaL_checktype(L, 2, LUA_TFUNCTION); /* must be a function */
405 lua_settop(L, 2); /* make sure there are two arguments */
406 auxsort(L, 1, (IdxT)n, 0);
407 }
408 return 0;
409}
410
411/* }====================================================== */
412

Callers

nothing calls this directly

Calls 3

luaL_checktypeFunction · 0.70
lua_settopFunction · 0.70
auxsortFunction · 0.70

Tested by

no test coverage detected