gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat
-rw-r--r--gdt.lua 16
1 files changed, 8 insertions, 8 deletions
diff --git a/gdt.lua b/gdt.lua
index 8bd3e90c..41f2a28d 100644
--- a/gdt.lua
+++ b/gdt.lua
@@ -112,7 +112,7 @@ local function gdt_table_icolumn(t, j)
end
local function val_tostr(e)
- return e and tostring(e) or ''
+ return e and tostring(e) or 'NA'
end
local function gdt_table_show(dt)
@@ -135,20 +135,20 @@ local function gdt_table_show(dt)
local lines = {}
- local t = {}
+ local row_ndig = #tostring(#dt)
+ local t = {string.rep(" ", row_ndig)}
for j = 1, c do
- t[j] = format(field_fmts[j], gdt_table_get_header(dt, j))
+ t[#t+1] = format(field_fmts[j], gdt_table_get_header(dt, j))
end
- lines[1] = '| ' .. concat(t, ' | ') .. ' |'
- lines[2] = string.rep('-', #lines[1])
+ lines[1] = concat(t, ' ')
for i = 1, r do
- local t = {}
+ local t = {format("%-" .. row_ndig .. "d", i)}
for j = 1, c do
local x = gdt_table_get(dt, i, j)
- t[j] = format(field_fmts[j], val_tostr(x))
+ t[#t+1] = format(field_fmts[j], val_tostr(x))
end
- lines[#lines + 1] = '| ' .. concat(t, ' | ') .. ' |'
+ lines[#lines + 1] = concat(t, ' ')
end
return concat(lines, '\n')
end
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月18日 02:22:17 +0000

AltStyle によって変換されたページ (->オリジナル) /