Module:MLB standings: Difference between revisions

Content deleted Content added
fix expansion of template
change to support different format for passing in home and road records
Line 22:
args[currentIdx+2] == nil or
args[currentIdx+3] == nil or
args[currentIdx+4] == nil) thenor
args[currentIdx+5] == nil or
args[currentIdx+6] == nil ) then
return nil
end
Line 29 ⟶ 31:
wins = tonumber(mw.text.trim(args[currentIdx+1])),
losses = tonumber(mw.text.trim(args[currentIdx+2])),
homeRecordhomeWins = mw.text.trim(args[currentIdx+3]),
roadRecordhomeLosses = mw.text.trim(args[currentIdx+4]),
roadWins = mw.text.trim(args[currentIdx+5]),
roadLosses = mw.text.trim(args[currentIdx+6]),
}
end -- function readTeamInfo()
Line 51 ⟶ 55:
fTeamInfoPresent = true
table.insert(listOfTeams, teamInfo)
currentArgIdx = currentArgIdx + 57
end
 
Line 96 ⟶ 100:
|| ' .. string.format('%.3f', teamInfo.wins / ( teamInfo.wins + teamInfo.losses )) .. '\
|| ' .. gamesBehind .. '\
|| ' .. teamInfo.homeRecordhomeWins .. ' || ' .. teamInfo.roadRecordhomeLosses .. '\n'
|| ' .. teamInfo.roadWins .. '–' .. teamInfo.roadLosses .. '\n'
)
end