Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sports table/totalscheck
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local tc = {} function tc.check(Args, team_list, ii_start, ii_end) local warn = {} local wtotal, dtotal, ltotal = 0,0,0 local hwtotal, hdtotal, hltotal = 0,0,0 local awtotal, adtotal, altotal = 0,0,0 local pkwtotal, pkltotal, otwtotal, otltotal = 0,0,0,0 local gftotal, gatotal = 0,0 for ii = ii_start, ii_end do -- First get code local team_code_ii = team_list[ii] if team_code_ii ~= 'SPORTS_TABLE_TOTAL' then -- Now tabulate values wtotal = wtotal + (tonumber(Args['win_'..team_code_ii]) or 0) dtotal = dtotal + (tonumber(Args['draw_'..team_code_ii]) or 0) ltotal = ltotal + (tonumber(Args['loss_'..team_code_ii]) or 0) hwtotal = hwtotal + (tonumber(Args['hwin_'..team_code_ii]) or 0) hdtotal = hdtotal + (tonumber(Args['hdraw_'..team_code_ii]) or 0) hltotal = hltotal + (tonumber(Args['hloss_'..team_code_ii]) or 0) awtotal = awtotal + (tonumber(Args['awin_'..team_code_ii]) or 0) adtotal = adtotal + (tonumber(Args['adraw_'..team_code_ii]) or 0) altotal = altotal + (tonumber(Args['aloss_'..team_code_ii]) or 0) pkwtotal = pkwtotal + (tonumber(Args['PKwin_'..team_code_ii]) or 0) pkltotal = pkltotal + (tonumber(Args['PKloss_'..team_code_ii]) or 0) otwtotal = otwtotal + (tonumber(Args['OTwin_'..team_code_ii]) or 0) otltotal = otltotal + (tonumber(Args['OTloss_'..team_code_ii]) or 0) gftotal = gftotal + (tonumber(Args['gf_'..team_code_ii]) or 0) + (tonumber(Args['pf_'..team_code_ii]) or 0) gatotal = gatotal + (tonumber(Args['ga_'..team_code_ii]) or 0) + (tonumber(Args['pa_'..team_code_ii]) or 0) end end if wtotal ~= ltotal then table.insert(warn, wtotal .. ' total wins != ' .. ltotal .. ' total losses') end if hwtotal ~= altotal then table.insert(warn, hwtotal .. ' total hwins != ' .. altotal .. ' total alosses') end if awtotal ~= hltotal then table.insert(warn, awtotal .. ' total awins != ' .. hltotal .. ' total hlosses') end if (2*math.floor(dtotal/2)) ~= dtotal then table.insert(warn, dtotal .. ' total draws is an odd number') end if hdtotal ~= adtotal then table.insert(warn, hdtotal .. ' total hdraw != ' .. adtotal .. ' total adraw') end if pkwtotal ~= pkltotal then table.insert(warn, pkwtotal .. ' total PKwins != ' .. pkltotal .. ' total PKlosses') end if otwtotal ~= otltotal then table.insert(warn, otwtotal .. ' total OTwins != ' .. otltotal .. ' total OTlosses') end if gftotal ~= gatotal then table.insert(warn, gftotal .. ' total for != ' .. gatotal .. ' total against') end return warn end return tc
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Error
(
edit
)
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Template:Sandbox other
(
edit
)
Module:Arguments
(
edit
)
Module:Error
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Sports table/totalscheck/doc
(
edit
)
Module:String
(
edit
)
Module:Yesno
(
edit
)