Professor Layton Wiki
Advertisement
Professor Layton Wiki
This module does not yet have any documentation.
Add documentation

--- This module generates a list of Archive subpages.
-- 
-- This uses expensive parser functions (#ifexist).
-- Note that there can be no gaps (eg. "Archive 3" exists, but "Archive 2" doesn't) or it won't work
local p = {}
 
function p.main(frame)
	local a = frame:getParent().args
	local pageName = mw.title.getCurrentTitle().fullText
 
	local i = 1
	local exists
	local ret = {}
	repeat
		local t = mw.title.new( pageName .. '/Archive_' .. i )
		exists = t.exists
		if exists then
			ret[#ret+1] = '[[' .. t.fullText .. '|' .. i .. ']]'
			i = i + 1
		end
	until not exists

	return table.concat(ret,' ')
end

return p

-- [[Category:Modules]]
Advertisement