模組:沙盒/DinoWP/Archivessub

local p = {}

function p.main( frame )
	local arg_1 = frame.args[ 1 ] or "{{{1}}}"
	local cMax = tonumber( frame.args.max or 4 ) or 4
	local output = ""
	
	local i = 1
	while i <= cMax do
		output = output .. string.format(
			"[[User talk:DinoWP/Archives/%s_S%d|{{#ifexist:User talk:DinoWP/Archives/%s_S%d|<span title=\"%sS%d存檔\">'''%d'''</span>|<span title=\"暫無此頁面\">%d</span>}}]]\n",
			arg_1, i, arg_1, i, arg_1, i, i, i
		)
		i = i + 1
	end
	
	return frame:preprocess( output )
end

return p