Line 39: |
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.insert(tbl.rows, {}) | + | table.insert(tbl.rows, 1, {}) |
− | local row = tbl.rows[#tbl.rows] | + | local row = tbl.rows[1] |
| + | row.id = arg_name |
| row.ship = ship | | row.ship = ship |
| + | row.type = '' |
| row.nodes = {} | | row.nodes = {} |
| for _, node in pairs(tbl.nodes) do | | for _, node in pairs(tbl.nodes) do |
Line 65: |
Line 67: |
| | | |
| local table_format = { | | local table_format = { |
− | header = '{| class="wikitable sortable" align="center" width="90%" style="text-align:center"\n!Ship\n', | + | header = '{| class="wikitable sortable" align="center" width="90%" style="text-align:center"\n!#\n!Type\n!Ship\n', |
| header_node = '!width="10%%"|%s\n', | | header_node = '!width="10%%"|%s\n', |
| header_boss_node = '!width="10%%" style="background-color:pink;color:red;"|\'\'\'%s\'\'\'\n', | | header_boss_node = '!width="10%%" style="background-color:pink;color:red;"|\'\'\'%s\'\'\'\n', |
− | ship_cell = '|-\n|[[%s]]\n', | + | row = '|-\n', |
| + | cell = '|%s\n', |
| + | ship_cell = '|[[%s]]\n', |
| node_cell = '|style="background-color:#%s;"|%s\n', | | node_cell = '|style="background-color:#%s;"|%s\n', |
| empty_cell = '|\n', | | empty_cell = '|\n', |
Line 85: |
Line 89: |
| -- rows | | -- rows |
| for _, row in pairs(tbl.rows) do | | for _, row in pairs(tbl.rows) do |
| + | res = res .. table_format.row |
| + | res = res .. string.format(table_format.cell, row.id) |
| res = res .. string.format(table_format.ship_cell, row.ship) | | res = res .. string.format(table_format.ship_cell, row.ship) |
| + | res = res .. string.format(table_format.cell, row.type) |
| for _, node in pairs(tbl.nodes) do | | for _, node in pairs(tbl.nodes) do |
| local node = row.nodes[node.name] | | local node = row.nodes[node.name] |