Module:Equipment

Revision as of 06:14, 11 December 2014 by com>Ckwng (Module for equipment entry point.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local Equipment = {}

local equipments = {}

local EquipmentData = require('Module:EquipmentData')

function Equipment:get(stat, name)
	return self:create(name)[stat]()
end

function Equipment:create(name)
	if equipments[name] then
		return equipments[name]
	else
		local equipment_table = require(mw.ustring.format('Module:%s', name))
		local equipment = EquipmentData:create(equipment_table)
		equipments[name] = equipment
		return equipment
	end
end

return Equipment