| 14722 | } |
| 14723 | |
| 14724 | static int sort_comp (lua_State *L, int a, int b) { |
| 14725 | if (!lua_isnil(L, 2)) { /* function? */ |
| 14726 | int res; |
| 14727 | lua_pushvalue(L, 2); |
| 14728 | lua_pushvalue(L, a-1); /* -1 to compensate function */ |
| 14729 | lua_pushvalue(L, b-2); /* -2 to compensate function and `a' */ |
| 14730 | lua_call(L, 2, 1); |
| 14731 | res = lua_toboolean(L, -1); |
| 14732 | lua_pop(L, 1); |
| 14733 | return res; |
| 14734 | } |
| 14735 | else /* a < b? */ |
| 14736 | return lua_lessthan(L, a, b); |
| 14737 | } |
| 14738 | |
| 14739 | static void auxsort (lua_State *L, int l, int u) { |
| 14740 | while (l < u) { /* for tail recursion */ |
no test coverage detected