aboutsummaryrefslogtreecommitdiff
path: root/weather.lua
diff options
context:
space:
mode:
Diffstat (limited to 'weather.lua')
-rw-r--r--weather.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/weather.lua b/weather.lua
index b83538e..e14c0ed 100644
--- a/weather.lua
+++ b/weather.lua
@@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { popen = io.popen }
+local math = { floor = math.floor }
local string = { match = string.match }
-- }}}
@@ -32,6 +33,7 @@ function worker(format, station)
["{city}"] = "N/A",
["{wind}"] = "N/A",
["{windmph}"] = "N/A",
+ ["{windkmh}"] = "N/A",
["{sky}"] = "N/A",
["{weather}"] = "N/A",
["{tempf}"] = "N/A",
@@ -62,6 +64,10 @@ function worker(format, station)
string.match(ws, "Relative[%s]Humidity:[%s]([%d]+)%%") or weather["{humid}"]
weather["{press}"] = -- Pressure in hPa
string.match(ws, "Pressure[%s].+%((.+)[%s]hPa%)") or weather["{press}"]
+ weather["{windkmh}"] = -- Wind speed in KMH if MPH was available
+ if weather["{windmph}"] ~= "N/A" then
+ weather["{windkmh}"] = math.floor(weather["{windmph}"] * 1.6)
+ end
end
return weather