- 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
Line 12:
Line 12:
+
− +
+
+
+
+
+
+
Don't hard fail when module require fails
if name == nil then
if name == nil then
return EquipmentData()
return EquipmentData()
--check if we already have it
elseif equipments[name] then
elseif equipments[name] then
return equipments[name]
return equipments[name]
else
else
local equipment_table = require(mw.ustring.format('Module:%s', name))
--Catch a failed require
local success, equipment_table = pcall(function () return require(mw.ustring.format('Module:%s', name)) end)
--require failed
if not success then
--create a EquipmentData with what we have
equipment_table = {_name = name}
end
local equipment = EquipmentData(equipment_table)
local equipment = EquipmentData(equipment_table)
equipments[name] = equipment
equipments[name] = equipment