aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/fun.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/luarocks/fun.lua b/src/luarocks/fun.lua
index 9ba02bf5..dfdf36ed 100644
--- a/src/luarocks/fun.lua
+++ b/src/luarocks/fun.lua
@@ -48,4 +48,19 @@ function fun.traverse(t, f)
48 end) 48 end)
49end 49end
50 50
51function fun.reverse_in(t)
52 for i = 1, math.floor(#t/2) do
53 local m, n = i, #t - i + 1
54 local a, b = t[m], t[n]
55 t[m] = b
56 t[n] = a
57 end
58 return t
59end
60
61function fun.sort_in(t, f)
62 table.sort(t, f)
63 return t
64end
65
51return fun 66return fun