Line 6: |
Line 6: |
| | | |
| local U = require('Module:Core') | | local U = require('Module:Core') |
− | local EliteShips = require('Module:EliteShips')
| |
| | | |
| local template = { | | local template = { |
Line 55: |
Line 54: |
| table.insert(result, template.footer) | | table.insert(result, template.footer) |
| return table.concat(result, "\n") | | return table.concat(result, "\n") |
− | end
| |
− |
| |
− | local function generateShipList(shipClass, remodelSuffix)
| |
− | local shipClass = shipClass or frame.args[1] or "??"
| |
− | local success, data = U.loadData("Data/Ship")
| |
− | if not success then return "No data for ships: " .. shipClass end
| |
− |
| |
− | local result = {}
| |
− |
| |
− | local suffix = {}
| |
− | local index = 1
| |
− | for k, v in pairs(remodelSuffix) do
| |
− | suffix[index] = v
| |
− | index = index + 1
| |
− | end
| |
− |
| |
− | for k, v in pairs(data) do
| |
− | if v.type == shipClass and v.remodellv ~= '' then
| |
− | local name = v.name[3]
| |
− | local success = 0
| |
− | for k, v in pairs(remodelSuffix) do
| |
− | if success == 0 then
| |
− | name,success = name:gsub("." .. v, "/" .. v)
| |
− | end
| |
− | end
| |
− | if success == 0 then
| |
− | name,success = name:gsub(".Kai", "/Kai")
| |
− | end
| |
− | table.insert(result, string.format(template.item, name))
| |
− | end
| |
− | end
| |
− |
| |
− | return result
| |
− | end
| |
− |
| |
− | local function eliteShipsCall(frame)
| |
− | local result = generateShipList(frame.args['shipClass'], frame.args['remodelSuffix'])
| |
− | local args = U.split(result, '|')
| |
− | return EliteShips.SortableTable(args)
| |
| end | | end |
| | | |
Line 103: |
Line 63: |
| | | |
| return generateTable(shipClass, remodelSuffix, notes, coloring) | | return generateTable(shipClass, remodelSuffix, notes, coloring) |
− | end | + | end |
| | | |
| local function test() | | local function test() |
Line 145: |
Line 105: |
| -- "ammo_operator = <", | | -- "ammo_operator = <", |
| -- "reference_type = 2"})) | | -- "reference_type = 2"})) |
− |
| + | |
− | local frame = {}
| |
− |
| |
| local frame = {} | | local frame = {} |
| frame.args = {} | | frame.args = {} |