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