跳转到内容

模組:DYKCount

被永久保护的模块
维基百科,自由的百科全书

这是本页的一个历史版本,由A2569875留言 | 贡献2020年3月1日 (日) 20:20编辑。这可能和当前版本存在着巨大的差异。

local p={}
local lib_var={};
function p.getDYKCount(frame)
	if lib_var._arg_process == nil then lib_var = require('Module:Var') end
	local args, working_frame = lib_var._arg_process(frame)
    local input_n = args[1] or args['1']
	local src = working_frame:preprocess{ text = "{{msgnw:" .. input_n .. "}}" }
	local st,ed = mw.ustring.find(src, "{{%s-[Pp]roduceEncouragement%s-|%s-count%s-=%s-%d+%s-}}" );
	if st then
		local dyk_template = mw.ustring.sub(src, st,ed)
		st,ed = mw.ustring.find(dyk_template, "count%s-=%s-%d+" )
		dyk_template = mw.text.decode(mw.ustring.sub(dyk_template, st,ed))
		st,ed = mw.ustring.find(dyk_template, "%d+" )
		local dyk_count = mw.ustring.sub(dyk_template, st,ed)
		return dyk_count;
	else
		return 0;
	end
end
return p;