Changes

no edit summary
Line 38: Line 38:  
function Ship:process_ship_key_as_reference(reference, base)
 
function Ship:process_ship_key_as_reference(reference, base)
 
name, model = self:process_ship_key(reference)
 
name, model = self:process_ship_key(reference)
if not name then
+
if #name == 0 then
 
name = base
 
name = base
 
end
 
end
Line 46: Line 46:  
function Ship:create_from_reference(reference, base)
 
function Ship:create_from_reference(reference, base)
 
name, model = self:process_ship_key(reference)
 
name, model = self:process_ship_key(reference)
if not name then
+
if #name == 0 then
 
name = base:base_name()
 
name = base:base_name()
 
end
 
end
Line 78: Line 78:  
ship_base_name = ship_key
 
ship_base_name = ship_key
 
else
 
else
ship_base_name = mw.ustring.sub(ship_key, 1, split - 1)
+
ship_base_name = split - 1 > 0 and mw.ustring.sub(ship_key, 1, split - 1) or ''
 
ship_suffix = mw.ustring.sub(ship_key, split + 1, -1)
 
ship_suffix = mw.ustring.sub(ship_key, split + 1, -1)
 
end
 
end
Anonymous user