• 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
Add short name support
Line 1: Line 1:  
local BaseData = require("Module:BaseData")
 
local BaseData = require("Module:BaseData")
local ShipClassData = BaseData({
+
local ShipClassData = BaseData{
 
_class_suffix = "Class",
 
_class_suffix = "Class",
})
+
}
    
function ShipClassData:base_name()
 
function ShipClassData:base_name()
 
return self._name
 
return self._name
 +
end
 +
 +
function ShipClassData:short_base_name()
 +
return self._short_name or self:base_name()
 
end
 
end
   Line 14: Line 18:  
end
 
end
 
table.insert(result, self:base_name())
 
table.insert(result, self:base_name())
 +
if self._suffix then
 +
table.insert(result, self._suffix)
 +
end
 +
return table.concat(result, " ")
 +
end
 +
 +
function ShipClassData:short_name()
 +
local result = {}
 +
if self._prefix then
 +
table.insert(result, self._prefix)
 +
end
 +
table.insert(result, self:short_base_name())
 
if self._suffix then
 
if self._suffix then
 
table.insert(result, self._suffix)
 
table.insert(result, self._suffix)
Anonymous user

Navigation menu