Software /
code /
prosody
Diff
prosodyctl @ 11002:b0766f2603e9
prosodyctl about: Use library function for sorted listing of lua modules
Code reuse and one less module to import is nice.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 10 Jul 2020 03:13:27 +0200 |
parent | 10964:d6a3d652ca32 |
child | 11003:c82ede8892fc |
line wrap: on
line diff
--- a/prosodyctl Thu Jul 09 02:17:49 2020 +0200 +++ b/prosodyctl Fri Jul 10 03:13:27 2020 +0200 @@ -378,8 +378,7 @@ end local pwd = "."; - local array = require "util.array"; - local keys = require "util.iterators".keys; + local sorted_pairs = require "util.iterators".sorted_pairs; local hg = require"util.mercurial"; local relpath = configmanager.resolve_relative_path; @@ -461,9 +460,8 @@ end module_versions["libunbound"] = lunbound._LIBVER; end - local sorted_keys = array.collect(keys(module_versions)):sort(); - for _, name in ipairs(sorted_keys) do - print(name..":"..string.rep(" ", longest_name-#name), module_versions[name]); + for name, version in sorted_pairs(module_versions) do + print(name..":"..string.rep(" ", longest_name-#name), version); end print(""); end