• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
fix ship order
Line 10: Line 10:  
}
 
}
   −
local colors = {
+
local diff_colors = {
 
['Easy']  = '5a5',
 
['Easy']  = '5a5',
 
['Medium'] = 'da6',
 
['Medium'] = 'da6',
Line 17: Line 17:  
}
 
}
   −
local diffs = {
+
local diff_names = {
 
['Easy']  = 'Easy+',
 
['Easy']  = 'Easy+',
 
['Medium'] = 'Medium+',
 
['Medium'] = 'Medium+',
Line 26: Line 26:  
function parseArgs(args)
 
function parseArgs(args)
   −
local table = { nodes = {}, rows = {} }
+
local tbl = { nodes = {}, rows = {} }
    
-- header args
 
-- header args
 
for node in string.gmatch(args.nodes, args_grammar.comma_list) do
 
for node in string.gmatch(args.nodes, args_grammar.comma_list) do
 
local node = node:match(args_grammar.to_trim)
 
local node = node:match(args_grammar.to_trim)
table.nodes[#table.nodes + 1] = { name = node }
+
table.insert(tbl.nodes, { name = node, boss = node == args.boss })
if node == args.boss then
  −
table.nodes[#table.nodes].boss = true
  −
end
   
end
 
end
   Line 42: Line 39:  
local ship, nodes = arg:match(args_grammar.ship_and_nodes)
 
local ship, nodes = arg:match(args_grammar.ship_and_nodes)
 
-- TODO: check ship existence?
 
-- TODO: check ship existence?
table.rows[ship] = {}
+
table.insert(tbl.rows, 1, {})
local row = table.rows[ship]
+
local row = tbl.rows[1]
 
row.ship = ship
 
row.ship = ship
 
row.nodes = {}
 
row.nodes = {}
for _, node in pairs(table.nodes) do
+
for _, node in pairs(tbl.nodes) do
 
row.nodes[node.name] = nil
 
row.nodes[node.name] = nil
 
end
 
end
Line 57: Line 54:  
-- TODO: check node existence?
 
-- TODO: check node existence?
 
if node then
 
if node then
row.nodes[node] = { color = diff and colors[diff] or colors['?'], diff = diff and diffs[diff] or '?' }
+
row.nodes[node] = { color = diff and diff_colors[diff] or diff_colors['?'], diff = diff and diff_names[diff] or '?' }
 
end
 
end
 
end
 
end
Line 63: Line 60:  
end
 
end
   −
return table
+
return tbl
    
end
 
end
Line 77: Line 74:  
}
 
}
   −
function showTable(table)
+
function showTable(tbl)
    
local res = table_format.header
 
local res = table_format.header
    
-- header
 
-- header
for _, node in pairs(table.nodes) do
+
for _, node in pairs(tbl.nodes) do
 
res = res .. string.format(node.boss and table_format.header_boss_node or table_format.header_node, node.name)
 
res = res .. string.format(node.boss and table_format.header_boss_node or table_format.header_node, node.name)
 
end
 
end
    
-- rows
 
-- rows
for ship, row in pairs(table.rows) do
+
for _, row in pairs(tbl.rows) do
res = res .. string.format(table_format.ship_cell, ship)
+
res = res .. string.format(table_format.ship_cell, row.ship)
for _, node in pairs(table.nodes) do
+
for _, node in pairs(tbl.nodes) do
 
local node = row.nodes[node.name]
 
local node = row.nodes[node.name]
 
res = res .. (node and string.format(table_format.node_cell, node.color, node.diff) or table_format.empty_cell)
 
res = res .. (node and string.format(table_format.node_cell, node.color, node.diff) or table_format.empty_cell)
cssedit, gkautomate
7,064

edits

Navigation menu