Line 18: |
Line 18: |
| local function GenerateTable(equipmentOrShip, itemType, remodelSuffix, notes, coloring, ...) | | local function GenerateTable(equipmentOrShip, itemType, remodelSuffix, notes, coloring, ...) |
| local success,data | | local success,data |
| + | local equipment = false |
| if equipmentOrShip == 'Equipment' then | | if equipmentOrShip == 'Equipment' then |
| success, data = U.loadData("Data/Equipment") | | success, data = U.loadData("Data/Equipment") |
| + | equipment = true |
| elseif equipmentOrShip == "Ship" then | | elseif equipmentOrShip == "Ship" then |
| success, data = U.loadData("Data/Ship") | | success, data = U.loadData("Data/Ship") |
| else | | else |
− | return "Invalid equipOrShip value: " .. equipmentOrShip | + | return "Invalid equipmentOrShip value: " .. equipmentOrShip |
| end | | end |
| if not success then return "No data for ships: " .. itemType end | | if not success then return "No data for ships: " .. itemType end |
Line 36: |
Line 38: |
| end | | end |
| | | |
| + | if not equipment then |
| for k, v in pairs(data) do | | for k, v in pairs(data) do |
| if v.type == itemType and v.remodellv ~= '' then | | if v.type == itemType and v.remodellv ~= '' then |
Line 47: |
Line 50: |
| result = result .. string.format(template.item, name) | | result = result .. string.format(template.item, name) |
| end | | end |
| + | end |
| + | else |
| + | for k, v in pairs(data) do |
| + | if v.type == itemType then |
| + | local name = v.name[2] |
| + | result = result .. string.format(template.item, name) |
| + | end |
| + | end |
| end | | end |
| | | |
Line 62: |
Line 73: |
| | | |
| function ListOfSortable.ParseAndGenerate(frame) | | function ListOfSortable.ParseAndGenerate(frame) |
− | local equipmentOrShip | + | local equipmentOrShip = {} |
| if frame.args['equipmentOrShip'] ~= nil then equipmentOrShip = frame.args['equipmentOrShip'] end | | if frame.args['equipmentOrShip'] ~= nil then equipmentOrShip = frame.args['equipmentOrShip'] end |
− | local itemType | + | local itemType = {} |
| if frame.args['itemType'] ~= nil then itemType = frame.args['itemType'] end | | if frame.args['itemType'] ~= nil then itemType = frame.args['itemType'] end |
| local remodelSuffix = {} | | local remodelSuffix = {} |
Line 121: |
Line 132: |
| frame.args['equipmentOrShip'] = "Equipment" | | frame.args['equipmentOrShip'] = "Equipment" |
| frame.args['itemType'] = "Small Caliber Main Gun" | | frame.args['itemType'] = "Small Caliber Main Gun" |
− | frame.args['itemType'] = "Destroyer"
| |
| frame.args['remodelSuffix'] = "" | | frame.args['remodelSuffix'] = "" |
| frame.args['notes'] = "" | | frame.args['notes'] = "" |