Module:Season

From A Wiki of Ice and Fire
Revision as of 18:32, 8 July 2018 by Abjiklam (talk | contribs) (Created page with "local iterate = require('Module:Iterate').main local p = {} function p._seasons(arg) local article = "Game of Thrones - Season " local seasons = iterate.main(arg) local r...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Documentation for this module may be created at Module:Season/doc

local iterate = require('Module:Iterate').main

local p = {}

function p._seasons(arg)
	local article = "Game of Thrones - Season "
	local seasons = iterate.main(arg)
	local root = mw.html.create('div')
	root:addClass(hlist)
	for season in seasons do
		root:wikitext("* [[" .. article .. tostring(season) .. "|" .. tostring(season) .. "]]")
	end
	return tostring(root)
end

function p.main(frame)
	local args = frame.args
    if args[1] == nil then
        args = frame:getParent().args
    end
    if args[1] == nil then
    	return ""
    end
    return p._seasons(args[1])
end

return p