Difference between revisions of "Module:IndianPremierLeague/GroupStageTable"

From blackwiki
Jump to navigation Jump to search
blackwiki>Jfd34
(isLimitedOvers = true)
blackwiki>Jfd34
Line 19: Line 19:
 
         end
 
         end
 
     end
 
     end
     return require("Module:CricketLeagueGroupStageSummary").create(year .. " IPL Group Stage Table", teams, args.useParentData and frame:getParent().args or args, true, nil, args.useWebSlice)
+
     return require("Module:CricketLeagueGroupStageSummary").create(frame, year .. " IPL Group Stage Table", teams, args.useParentData, true, nil, args.useWebSlice)
 
end
 
end
 
   
 
   
 
return _module
 
return _module

Revision as of 05:40, 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 teams = {}
    
    do
        -- Get the team objects for the given teams
        local i = 1
        local teamTable = mw.loadData("Module:IndianPremierLeague/Teams")
        for t in mw.text.gsplit(args.teams or error("Missing parameter: 'teams'"), '%s*,%s*') do
            local teamObj = teamTable[t]
            if not teamObj or year < teamObj.startYear or (teamObj.endYear and teamObj.endYear < year) then
                error("Team '" .. t .. "' does not exist or is not valid for the given year.")
            end
            teams[i] = teamObj
            i = i + 1
        end
    end
    return require("Module:CricketLeagueGroupStageSummary").create(frame, year .. " IPL Group Stage Table", teams, args.useParentData, true, nil, args.useWebSlice)
end
 
return _module