MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / sort

Function sort

3rd/lua-5.4.3/src/ltablib.c:398–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 6

MatchAndExplainMethod · 0.85
GetSortedTestSuitesMethod · 0.85
GetSortedTestsMethod · 0.85
TearDownTestSuiteMethod · 0.85
TESTFunction · 0.85
LookUpMethod · 0.85

Calls 3

luaL_checktypeFunction · 0.85
lua_settopFunction · 0.85
auxsortFunction · 0.85

Tested by 4

GetSortedTestSuitesMethod · 0.68
GetSortedTestsMethod · 0.68
TearDownTestSuiteMethod · 0.68
TESTFunction · 0.68