Module:Patch: Difference between revisions

From Wavu Wiki, the 🌊 wavy Tekken wiki
No edit summary
No edit summary
Line 22: Line 22:
local notes = ""
local notes = ""
local globalNotes = frame:callParserFunction{
name = '#lsth',
args = { page, "General changes" }
}
if globalNotes ~= "" then
notes = notes .. globalNotes .. "\n"
end
local charNotes = frame:callParserFunction{
local charNotes = frame:callParserFunction{
Line 29: Line 37:
if charNotes ~= "" then
if charNotes ~= "" then
notes = notes .. charNotes .. "\n"
notes = notes .. charNotes .. "\n"
end
local globalNotes = frame:callParserFunction{
name = '#lsth',
args = { page, "General changes" }
}
if globalNotes ~= "" then
notes = notes .. globalNotes .. "\n"
end
end

Revision as of 08:35, 15 June 2021

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

local p = {}

-- Only including recent versions until the notes are tidied up, still big WIP
local versions = {
	{ "4.20", "27 May 2021" },
	{ "4.10", "22 Mar 2021" },
	{ "4.01", "26 Nov 2020" },
	{ "4.00", "10 Nov 2020" },
}

p.log = function(frame)
	local char = frame.args[1]
	return p._log(char)
end

p._log = function(char)
	local frame = mw.getCurrentFrame()
	local ret = ""
	for _, obj in ipairs(versions) do
		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
	
	return ret
end

p.date = function(frame)
	local v = frame.args[1]
	return p._date(v)
end

p._date = function(v)
	for _, version in ipairs(versions) do
		if version[1] == v then
			return version[2]
		end
	end
	return ""
end

return p