Line 46: |
Line 46: |
| !colspan="4"|Equipment | | !colspan="4"|Equipment |
| ]=] | | ]=] |
| + | |
| + | local fleetNames = require('Module:Fleet/Names') |
| | | |
| local function getFleetName(fleet, event) | | local function getFleetName(fleet, event) |
− | local names = require('Module:Fleet/Names')[event] or {} | + | local names = fleetNames[event] or {} |
| if names[1] then | | if names[1] then |
| for _, f in ipairs(names) do | | for _, f in ipairs(names) do |
| for _, ship in ipairs(f.ships) do | | for _, ship in ipairs(f.ships) do |
− | if U.ifindBy(fleet, function (e) return U.startsWith(e.ship, ship) end) then | + | for _, e in ipairs(fleet) do |
− | return f.name
| + | if string.sub(e.ship, 1, string.len(ship)) == ship then |
| + | return f.name |
| + | end |
| end | | end |
| end | | end |
Line 60: |
Line 64: |
| for name, ships in pairs(names) do | | for name, ships in pairs(names) do |
| for _, ship in ipairs(ships) do | | for _, ship in ipairs(ships) do |
− | if U.ifindBy(fleet, function (e) return U.startsWith(e.ship, ship) end) then | + | for _, e in ipairs(fleet) do |
− | return name
| + | if string.sub(e.ship, 1, string.len(ship)) == ship then |
| + | return name |
| + | end |
| end | | end |
| end | | end |