Module:Changelog

From Wavu Wiki, the 🌊 wavy Tekken wiki

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

local p = {}
local versions = require("Module:Patch").versions

p.main = function(frame)
	local char = frame.args[1]
	return p._main(char)
end

p._main = function(char)
	local frame = mw.getCurrentFrame()
	local ret = ""
	for _, obj in ipairs(versions) do
		if obj[3] == true then
			local version, date = obj[1], obj[2]
			local page = "Version " .. version
			
			local notes = ""
			
			-- local globalNotes = frame:callParserFunction{
			-- 	name = '#lsth',
			-- 	args = { page, "General changes" }
			-- }
			-- if globalNotes ~= "" then
			-- 	notes = notes .. globalNotes .. "\n"		
			-- end
			
			local charNotes = frame:callParserFunction{
				name = '#lsth',
				args = { page, char }
			}
			if charNotes ~= "" then
				notes = notes .. charNotes .. "\n"
			end
			
			if notes ~= "" then
				local h2 = "==" .. version .. ", " .. date .. "=="
				local hat = frame:expandTemplate{
					title = "Hatnote",
					args = { "Main article: [[" .. page .. "]]" }
				}
				ret = ret .. h2 .. "\n\n" .. hat .. "\n" .. notes
			end
		end
	end
	
	return ret
end

return p