• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
no edit summary
Line 1: Line 1:  +
local U = require("Module:Utils")
 
local BaseData = require('Module:BaseData')
 
local BaseData = require('Module:BaseData')
   Line 55: Line 56:     
function Ship:get_table(name, model)
 
function Ship:get_table(name, model)
--Catch a failed require
+
local success, ship_table = U.requireModule(name)
local success, ship_table = pcall(function () return require(mw.ustring.format('Module:%s', name)) end)
  −
--require succeeded
   
if success then
 
if success then
 
ship_table = ship_table[model]
 
ship_table = ship_table[model]
if not ship_table then
+
if type(ship_table) == "string" then
--create a ShipData with what we have
  −
ship_table = {_name = name, _suffix = model}
  −
elseif type(ship_table) == "string" then
   
ship_table = self:get_table(self:process_ship_key_as_reference(ship_table, name))
 
ship_table = self:get_table(self:process_ship_key_as_reference(ship_table, name))
end
+
    end
--require failed
+
    end
else
+
if not ship_table then
--create a ShipData with what we have
+
ship_table = { _name = name, _suffix = model }
ship_table = {_name = name, _suffix = model}
   
end
 
end
 +
if ship_table._name == nil then
 +
    ship_table._name = name
 +
    end
 +
if ship_table._suffix == nil then
 +
    ship_table._suffix = model
 +
    end
 
return ship_table
 
return ship_table
 
end
 
end
cssedit, gkautomate
7,064

edits

Navigation menu