Changes
Module for accessing Ship Class data
local BaseData = require("Module:BaseData")
local ShipClassData = BaseData({
_class_suffix = "Class",
_type_prefix = "Type",
})
function ShipClassData:base_name()
return self._name
end
function ShipClassData:name()
local result = {}
if self._prefix then
table.insert(result, self._prefix)
end
table.insert(result, self:base_name())
if self._suffix then
table.insert(result, self._suffix)
end
return table.concat(result, " ")
end
function ShipClassData:create(class)
class = class or {}
if class._class and not class._suffix then
class._suffix = self._class_suffix
end
if class._type and not class._prefix then
class._prefix = self._type_prefix
end
setmetatable(class, class)
class.__index = self
return class
end
ShipClassData.__call = ShipClassData.create
return ShipClassData
local ShipClassData = BaseData({
_class_suffix = "Class",
_type_prefix = "Type",
})
function ShipClassData:base_name()
return self._name
end
function ShipClassData:name()
local result = {}
if self._prefix then
table.insert(result, self._prefix)
end
table.insert(result, self:base_name())
if self._suffix then
table.insert(result, self._suffix)
end
return table.concat(result, " ")
end
function ShipClassData:create(class)
class = class or {}
if class._class and not class._suffix then
class._suffix = self._class_suffix
end
if class._type and not class._prefix then
class._prefix = self._type_prefix
end
setmetatable(class, class)
class.__index = self
return class
end
ShipClassData.__call = ShipClassData.create
return ShipClassData