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

Function sort

third-party/lua-5.5.0/src/ltablib.c:394–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

luaL_checktypeFunction · 0.70
lua_settopFunction · 0.70
auxsortFunction · 0.70

Tested by

no test coverage detected