Wowpedia
Advertisement
Wowpedia
229,881
pages

Documentation for this module may be created at Module:API info/patch/doc

local patch_data = {
	retail = mw.loadData("Module:API_info/patch/api_retail"),
	classic = mw.loadData("Module:API_info/patch/api_classic"),
}

local m = {}

local function GetLink(patch)
	return string.format("[[Patch_%s/API_changes|%s]]", patch, patch)
end

function m:GetPatches(name)
	local addedTbl, removedTbl = {}, {}
	local patch = {
		retail = patch_data.retail[name],
		classic = patch_data.classic[name],
	}
	if patch.retail then
		table.insert(addedTbl, GetLink(patch.retail[1]))
		if patch.retail[2] then
			table.insert(removedTbl, GetLink(patch.retail[2]))
		end
	end
	if patch.classic then
		table.insert(addedTbl, GetLink(patch.classic[1]))
		if patch.classic[2] then
			table.insert(removedTbl, GetLink(patch.classic[2]))
		end
	end
	local added = table.concat(addedTbl, " / ")
	local removed = table.concat(removedTbl, " / ")
	return added, removed
end

return m