Software /
code /
prosody
Diff
util/human/io.lua @ 10896:c7a0eab27165
util.human.io: table: Fix title printing when columns use named keys
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 04 Jun 2020 10:39:55 +0100 |
parent | 10894:d15a4284fdf8 |
child | 10904:d009a79f723a |
line wrap: on
line diff
--- a/util/human/io.lua Thu Jun 04 10:39:12 2020 +0100 +++ b/util/human/io.lua Thu Jun 04 10:39:55 2020 +0100 @@ -121,13 +121,14 @@ 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).." ";