Comparison

util/human/io.lua @ 11893:afef1e170de7

util.human.io: Support specifying column defaults in tables
author Kim Alvefur <zash@zash.se>
date Fri, 12 Nov 2021 11:44:31 +0100
parent 11892:e712133b4de1
child 11894:57106c61d104
comparison
equal deleted inserted replaced
11892:e712133b4de1 11893:afef1e170de7
134 local v = row[not titles and column.key or i]; 134 local v = row[not titles and column.key or i];
135 if not titles and column.mapper then 135 if not titles and column.mapper then
136 v = column.mapper(v, row); 136 v = column.mapper(v, row);
137 end 137 end
138 if v == nil then 138 if v == nil then
139 v = ""; 139 v = column.default or "";
140 else 140 else
141 v = tostring(v); 141 v = tostring(v);
142 end 142 end
143 if #v < width then 143 if #v < width then
144 if column.align == "right" then 144 if column.align == "right" then