Difference between revisions of "Module:IndianPremierLeague/GroupStageTable"
Jump to navigation
Jump to search
blackwiki>Jfd34 |
blackwiki>Jfd34 |
||
| Line 4: | Line 4: | ||
local args = frame.args | local args = frame.args | ||
local year = tonumber(args.year) or error("Parameter: 'year' is missing or invalid") | local year = tonumber(args.year) or error("Parameter: 'year' is missing or invalid") | ||
| − | |||
| − | + | local j = 1 | |
| − | + | local teams = mw.loadData("Module:IndianPremierLeague/Teams") | |
| − | + | local filteredTeams = {} | |
| − | + | for i, v in ipairs(teams) do | |
| − | + | -- Filter the teams based on the year | |
| − | + | if year >= v.startYear and (not v.endYear or v.endYear >= year) then | |
| − | + | filteredTeams[j] = v | |
| − | + | j = j + 1 | |
| − | |||
| − | |||
| − | |||
end | end | ||
end | end | ||
| − | return require("Module:CricketLeagueGroupStageSummary").create(frame, year .. " IPL Group Stage | + | |
| + | return require("Module:CricketLeagueGroupStageSummary").create(args.useParentData and frame:getParent() or frame, year .. " IPL Group Stage Match Summary", filteredTeams, true, nil, args.useWebSlice) | ||
end | end | ||
return _module | return _module | ||
Revision as of 09:07, 7 April 2014
local _module = {}
_module.create = function(frame)
local args = frame.args
local year = tonumber(args.year) or error("Parameter: 'year' is missing or invalid")
local j = 1
local teams = mw.loadData("Module:IndianPremierLeague/Teams")
local filteredTeams = {}
for i, v in ipairs(teams) do
-- Filter the teams based on the year
if year >= v.startYear and (not v.endYear or v.endYear >= year) then
filteredTeams[j] = v
j = j + 1
end
end
return require("Module:CricketLeagueGroupStageSummary").create(args.useParentData and frame:getParent() or frame, year .. " IPL Group Stage Match Summary", filteredTeams, true, nil, args.useWebSlice)
end
return _module