Module:Talk Archives

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

local startYear = 2007

local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end

local p = {}

function p._main(args) local page = getTitleObject(args.page) or mw.title.getCurrentTitle local thisYear = os.date('%Y') local root = mw.html.create for year = startYear, thisYear, 1 do		local title = page:subPageTitle(tostring(year)) if title.exists then root:wikitext('* ' .. year .. '\n') end end return tostring(root) end

function p.main(frame) return p._main(getArgs(frame)) end

return p