Line 83: |
Line 83: |
| | | |
| function NanaminShipInfo:build_table(class, remove_headers) | | function NanaminShipInfo:build_table(class, remove_headers) |
− | if self._sorted_entries[class] ~= nil then | + | if self._sorted_entries[class] ~= nil or class == "All" then |
| if not remove_headers then | | if not remove_headers then |
| table.insert(self._rows, [[<div style="text-align: center;">]]) | | table.insert(self._rows, [[<div style="text-align: center;">]]) |
Line 91: |
Line 91: |
| table.insert(self._rows, self._table_start) | | table.insert(self._rows, self._table_start) |
| | | |
− | local entries = self._sorted_entries[class] | + | local entries = {} |
| + | if class == "All" then |
| + | for ship_type, entry_table in pairs(self._sorted_entries) do |
| + | for _, entry in pairs(entry_table) do |
| + | table.insert(entries, entry) |
| + | end |
| + | end |
| + | else |
| + | entries = self._sorted_entries[class] |
| + | end |
| table.sort(entries, function(a, b) return a[2] < b[2] end) | | table.sort(entries, function(a, b) return a[2] < b[2] end) |
| local count = 0 | | local count = 0 |
Line 122: |
Line 131: |
| function NanaminShipInfo:build_one(class, remove_headers) | | function NanaminShipInfo:build_one(class, remove_headers) |
| self:build_table(class, remove_headers) | | self:build_table(class, remove_headers) |
| + | return table.concat(self._rows, "\n") |
| + | end |
| + | |
| + | function NanaminShipInfo:build_all() |
| + | self:build_table("All", true) |
| return table.concat(self._rows, "\n") | | return table.concat(self._rows, "\n") |
| end | | end |
Line 130: |
Line 144: |
| table.insert(self._rows, "__NOTOC__") | | table.insert(self._rows, "__NOTOC__") |
| if args["class"] then return self:build_one(args["class"], args["remove_headers"]) end | | if args["class"] then return self:build_one(args["class"], args["remove_headers"]) end |
| + | if args["all"] then return self:build_all() end |
| self:build_table("Battleship") | | self:build_table("Battleship") |
| self:build_table("Carrier") | | self:build_table("Carrier") |