# HG changeset patch # User Matthew Wild # Date 1591263595 -3600 # Node ID c7a0eab271658410f55d716777533bde0af4a3ee # Parent 5777968301e8bb21cfae9ba976ca8d864aa1d51f util.human.io: table: Fix title printing when columns use named keys diff -r 5777968301e8 -r c7a0eab27165 util/human/io.lua --- 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).." ";