aboutsummaryrefslogtreecommitdiff
path: root/lib/utils.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-10-09 20:17:38 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2017-10-09 20:17:38 -0700
commita858775a6831e5d880d9c0f88470f12a7e9b91f9 (patch)
treeb2abd90975ff0aabbe84173e41a373c9d365e40c /lib/utils.nom
parentf553bf2948dc8ece1c9ec98df3efd6ce6cc4e56e (diff)
Fixing up sorting more.
Diffstat (limited to 'lib/utils.nom')
-rw-r--r--lib/utils.nom8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/utils.nom b/lib/utils.nom
index 2e469c5..55df1b7 100644
--- a/lib/utils.nom
+++ b/lib/utils.nom
@@ -87,11 +87,9 @@ compile [max of %items by %value_expr] to:
| return \(%value_expr as lua)
|end)
compile [sort %items] to: "table.sort(\(%items as lua))"
-compile [sort %items by %key] to: ".."
- |nomsu.utils.sort(\(%items as lua), function(x)
- | local ret, vars = nil, {['']=x};
- | \(%key as lua statements)
- | return ret
+rule [sort %items by %key] =: lua expr ".."
+ |nomsu.utils.sort(\(%items), function(x)
+ | return (\(%key))(nomsu, {['']=x});
|end)
# String utilities