Software /
code /
prosody
Comparison
plugins/mod_admin_shell.lua @ 13042:0f05804e974d
mod_admin_shell: Make default column width 1 part
These gets used for usernames, resources and other random session fields
that don't have a column definition in `available_columns`
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 07 Apr 2023 13:07:00 +0200 |
parent | 13041:61b00bd20074 |
child | 13043:d4f7118d1531 |
comparison
equal
deleted
inserted
replaced
13041:61b00bd20074 | 13042:0f05804e974d |
---|---|
997 local function get_colspec(colspec, default) | 997 local function get_colspec(colspec, default) |
998 if type(colspec) == "string" then colspec = array(colspec:gmatch("%S+")); end | 998 if type(colspec) == "string" then colspec = array(colspec:gmatch("%S+")); end |
999 local columns = {}; | 999 local columns = {}; |
1000 for i, col in pairs(colspec or default) do | 1000 for i, col in pairs(colspec or default) do |
1001 if type(col) == "string" then | 1001 if type(col) == "string" then |
1002 columns[i] = available_columns[col] or { title = capitalize(col); width = 20; key = col }; | 1002 columns[i] = available_columns[col] or { title = capitalize(col); width = "1p"; key = col }; |
1003 elseif type(col) ~= "table" then | 1003 elseif type(col) ~= "table" then |
1004 return false, ("argument %d: expected string|table but got %s"):format(i, type(col)); | 1004 return false, ("argument %d: expected string|table but got %s"):format(i, type(col)); |
1005 else | 1005 else |
1006 columns[i] = col; | 1006 columns[i] = col; |
1007 end | 1007 end |