Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:F1 2021 Results
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 p = {}; local data = { ["VER"] = { ["_points"] = 105, ["BHR"] = "2", ["EMI"] = "1", ["POR"] = "2", ["ESP"] = "2", ["MON"] = "1", ["AZE"] = "", }, ["NOR"] = { ["_points"] = 56, ["BHR"] = "4", ["EMI"] = "3", ["POR"] = "5", ["ESP"] = "8", ["MON"] = "3", ["AZE"] = "", }, ["ALO"] = { ["_points"] = 5, ["BHR"] = "Ret", ["EMI"] = "10", ["POR"] = "8", ["ESP"] = "17", ["MON"] = "13", ["AZE"] = "", }, } local colorCodes = { ["1"] = "#FFFFBF", ["2"] = "#DFDFDF", ["3"] = "#FFDF9F", ["Ret"] = "#EFCFFF", ["NC"] = "#CFCFFF", ["DNQ"] = "#FFCFCF", ["DNPQ"] = "#FFCFCF", ["DSQ"] = "#000000; color:white", ["DNS"] = "#FFFFFF", ["C"] = "#FFFFFF", } local function getColor(result) local colorFromTable = colorCodes[result] if colorFromTable ~= nil then return colorFromTable end local resultAsNumber = tonumber(result) if resultAsNumber ~= nil then if 4 <= resultAsNumber and resultAsNumber <= 10 then return "#DFFFDF" elseif 11 <= resultAsNumber then return "#CFCFFF" end end return "none" end function p.getRaceResult(frame) local driverCode = frame.args[1] local raceCode = frame.args[2] local result = data[driverCode][raceCode] local color = getColor(result) return 'style="background:' .. color .. ';"|' .. result end function p.getPoints(frame) local driverCode = frame.args[1] return data[driverCode]["_points"] end function p.test() -- For debug only mw.log(p.getRaceResult({args={"VER", "BHR"}})) mw.log(p.getPoints({args={"VER"}})) end return p
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:Abbr
(
edit
)
Template:Flagicon
(
edit
)
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Template:Sandbox other
(
edit
)
Module:Arguments
(
edit
)
Module:F1 2021 Results
(
edit
)
Module:F1 2021 Results/doc
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:String
(
edit
)
Module:Yesno
(
edit
)