Module:Weather

From Paw Borough Wiki
Revision as of 16:19, 29 September 2023 by Imiya (talk | contribs) (Created page with "local p = {} function p.getWeather(weather) local switch = { ["Sunny"] = "File:SunnyIcon.png", -- ["PartlyCloudy"] = "File:PartlyCloudyIcon.png", -- ["Snowy"] = "File:SnowyIcon.png", -- ["Cloudy"] = "File:CloudyIcon.png", -- ["Rainy"] = "File:RainyIcon.png", -- } return switch[weather] end -- Main function that calls getTheme with a passed-in theme argument function p.main(...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Weather/doc

local p = {}

function p.getWeather(weather)
local switch = {
       ["Sunny"]        = "[[File:SunnyIcon.png]]",   -- 
       ["PartlyCloudy"]           = "[[File:PartlyCloudyIcon.png]]",   -- 
       ["Snowy"] = "[[File:SnowyIcon.png]]",  -- 
       ["Cloudy"]     = "[[File:CloudyIcon.png]]",  -- 
       ["Rainy"]     = "[[File:RainyIcon.png]]", -- 
   }
   return switch[weather]
end

-- Main function that calls getTheme with a passed-in theme argument
function p.main(frame)
    -- The theme parameter is first positional, or nil if unspecified.
    local weather = frame:getParent().args[1]
    return p.getWeather(weather)
end

return p