MCPcopy Create free account
hub / github.com/DFHack/dfhack / sort

Function sort

depends/lua/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 15

loadScriptFilesFunction · 0.85
heap_take_snapshotFunction · 0.85
getNoblePositionsMethod · 0.85
ListFieldsMethod · 0.85
SortFieldsByNumberFunction · 0.85
OptimizePaddingFunction · 0.85
place_veinsMethod · 0.85
printMatsFunction · 0.85
sortMethod · 0.85
grab_optMethod · 0.85
loadMethod · 0.85

Calls 3

luaL_checktypeFunction · 0.85
lua_settopFunction · 0.85
auxsortFunction · 0.85

Tested by 1

printMatsFunction · 0.68