aboutsummaryrefslogtreecommitdiff
path: root/hddtemp.lua
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2009-10-26 20:32:48 +0100
committerAdrian C. (anrxc) <anrxc@sysphere.org>2009-10-26 20:32:48 +0100
commit0d73f6d8ae32f1cd48ce9f089b902eb0877605e1 (patch)
tree80d41d5fb6095610c781d47fa1a34e91cf184ce3 /hddtemp.lua
parentb105ae21cd47682a4e426604cb15ee6c11aea201 (diff)
downloadvicious-legacy-0d73f6d8ae32f1cd48ce9f089b902eb0877605e1.tar.xz
Ensure returned numbers are of type number
Thanks to Felix for bringing this to my attention. Obviously there was already a safety net for feeding progressbars and graphs... and while this makes for a good coding practice it's not a big deal. We have widgets of type textbox for one, and a lot of string concatenation happens. Strings are formatted, markup is applied...
Diffstat (limited to 'hddtemp.lua')
-rw-r--r--hddtemp.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/hddtemp.lua b/hddtemp.lua
index 9e35b5f..11952b9 100644
--- a/hddtemp.lua
+++ b/hddtemp.lua
@@ -4,6 +4,7 @@
---------------------------------------------------
-- {{{ Grab environment
+local tonumber = tonumber
local io = { popen = io.popen }
local setmetatable = setmetatable
local string = { match = string.match }
@@ -27,7 +28,7 @@ local function worker(format, port)
local disk, temp = string.match(line, "|([%/%a]+)|.*|([%d]+)|[CF]+|")
if disk ~= nil and temp ~= nil then
- hdd_temp["{"..disk.."}"] = temp
+ hdd_temp["{"..disk.."}"] = tonumber(temp)
end
end
f:close()