From 1630b786d4028a8075695c026391ee80cc9b9aca Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Sat, 1 Aug 2009 06:20:31 +0200 Subject: Added wind speed in km/h to the weather widget. --- weather.lua | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v1.2.3