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

Difference between revisions of "Module:EquipmentCardKai"

From Kancolle Wiki
Jump to navigation Jump to search
com>Ckwng
(Created page with "local Equipment = require('Module:Equipment') local Formatting = require('Module:Formatting') local EquipmentCardKai = { _card_size = "260x260px", } function EquipmentCardK...")
 
com>Ckwng
Line 2: Line 2:
 
local Formatting = require('Module:Formatting')
 
local Formatting = require('Module:Formatting')
  
local EquipmentCardKai = {
+
local EquipmentCardKai = {}
_card_size = "260x260px",
 
}
 
  
function EquipmentCardKai:card(equipment, args)
+
function EquipmentCardKai:card(equip, args, link)
 
if not args then
 
if not args then
args = equipment
+
args = equip
equipment = args.equipment
+
equip = args.equip
 
end
 
end
return Formatting:format_image{equipment:card(), size = args.size or self._card_size, link = args.link, caption = args.caption}
+
return Formatting:format_image{equip:card(), size = args.size, link = link, caption = args.caption}
 
end
 
end
  
 
function EquipmentCardKai:Card(args)
 
function EquipmentCardKai:Card(args)
local equipment = self:create_equipment(args)
+
local equip = self:create_equip(args)
return self:card(equipment, args)
+
if args.link then
 +
if args.link == "nil" then
 +
return self:card(equip, args, nil)
 +
elseif args.link == "false" then
 +
return self:card(equip, args, false)
 +
else
 +
return self:card(equip, args, args.link)
 +
end
 +
else
 +
return self:card(equip, args, equip:link())
 +
end
 
end
 
end
  
function EquipmentCardKai:create_equipment(args)
+
function EquipmentCardKai:create_equip(args)
 
return Equipment(args[1])
 
return Equipment(args[1])
 
end
 
end
  
 
return EquipmentCardKai
 
return EquipmentCardKai

Revision as of 21:49, 14 September 2015

Documentation for this module may be created at Module:EquipmentCardKai/doc

local Equipment = require('Module:Equipment')
local Formatting = require('Module:Formatting')

local EquipmentCardKai = {}

function EquipmentCardKai:card(equip, args, link)
	if not args then
		args = equip
		equip = args.equip
	end
	return Formatting:format_image{equip:card(), size = args.size, link = link, caption = args.caption}
end

function EquipmentCardKai:Card(args)
	local equip = self:create_equip(args)
	if args.link then
		if args.link == "nil" then
			return self:card(equip, args, nil)
		elseif args.link == "false" then
			return self:card(equip, args, false)
		else
			return self:card(equip, args, args.link)
		end
	else
		return self:card(equip, args, equip:link())
	end
end

function EquipmentCardKai:create_equip(args)
	return Equipment(args[1])
end

return EquipmentCardKai