diff options
author | Matthew Wild <mwild1@gmail.com> | 2020-06-04 10:39:55 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2020-06-04 10:39:55 +0100 |
commit | 506a747629dcbeb61be9735a86994d70c1379e40 (patch) | |
tree | df8b2ff667c2a94b350fd33fba0855f11fa6a59c /util/human | |
parent | 6950744de9817d0d29897d72605656807853588d (diff) | |
download | prosody-506a747629dcbeb61be9735a86994d70c1379e40.tar.gz prosody-506a747629dcbeb61be9735a86994d70c1379e40.zip |
util.human.io: table: Fix title printing when columns use named keys
Diffstat (limited to 'util/human')
-rw-r--r-- | util/human/io.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/util/human/io.lua b/util/human/io.lua index 8c328c14..9e700e89 100644 --- a/util/human/io.lua +++ b/util/human/io.lua @@ -121,13 +121,14 @@ local function new_table(col_specs, max_width, padding) end return function (row) + local titles; if not row then - row = array.pluck(col_specs, "title"); + titles, row = true, array.pluck(col_specs, "title", ""); end local output = {}; for i, column in ipairs(col_specs) do local width = widths[i]; - local v = tostring(row[column.key or i] or ""):sub(1, width); + local v = tostring(row[not titles and column.key or i] or ""):sub(1, width); if #v < width then if column.align == "right" then v = padleft(v, width-1).." "; |