Module:VOCALOID殿堂曲/Stats:修订间差异

来自Vocawiki
跳转到导航 跳转到搜索
AdorN留言 | 贡献
创建页面,内容为“local module = {} local getArgs = require('Module:Arguments').getArgs function module.count(page) local title = mw.title.new(page) local content = title:getContent() if not content then return end local count = 0 for i in string.gmatch(content, "t?T?emple ?_?Song") do count = count + 1 end return count end function module.main(frame) local args = getArgs(frame) local prefix = args['prefix'] local startYear = args['startYear'] local includeS…”
 
(没有差异)

2025年9月15日 (一) 12:08的最新版本

此模块的文档可以在Module:VOCALOID殿堂曲/Stats/doc创建

local module = {}

local getArgs = require('Module:Arguments').getArgs

function module.count(page)
	local title = mw.title.new(page)
	local content = title:getContent()
	if not content then
		return
	end

	local count = 0
	for i in string.gmatch(content, "t?T?emple ?_?Song") do
		count = count + 1
	end

	return count
end

function module.main(frame)
	local args = getArgs(frame)
	local prefix = args['prefix']
	local startYear = args['startYear']
	local includeSelf = args['includeSelf']
	local i = startYear
	local total = 0
	
	if includeSelf then
		local count = module.count(prefix)
		if count then
			total = count
		end
	end
	
	while true do
		local count = module.count(string.format("%s/%d年投稿", prefix, i))
		if not count then
			break
		end
		total = total + count
		i = i + 1
	end
	return tostring(total)
end

return module