diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-11-12 01:43:00 +0100 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-11-12 01:44:32 +0100 |
commit | 3834caa904de9107899708c1209ff5f530fc8d93 (patch) | |
tree | 09b01c1a662171e9cae44510228570e30de966be /hddtemp.lua | |
parent | 1790abb0eddaeb2c19017711f5d33e978d74b199 (diff) | |
download | vicious-legacy-3834caa904de9107899708c1209ff5f530fc8d93.tar.xz |
hddtemp: fixed support for multiple devices
Diffstat (limited to 'hddtemp.lua')
-rw-r--r-- | hddtemp.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/hddtemp.lua b/hddtemp.lua index a2557fa..366f40b 100644 --- a/hddtemp.lua +++ b/hddtemp.lua @@ -7,7 +7,7 @@ local tonumber = tonumber local io = { popen = io.popen } local setmetatable = setmetatable -local string = { match = string.match } +local string = { gmatch = string.gmatch } -- }}} @@ -25,9 +25,8 @@ local function worker(format, port) local hdd_temp = {} for line in f:lines() do - local disk, temp = string.match(line, "|([%/%a%d]+)|.*|([%d]+)|[CF]+|") - - if disk ~= nil and temp ~= nil then + for disk, temp in string.gmatch(line, "|([%/%a%d]+)|.-|([%d]+)|[CF]+|") + do hdd_temp["{"..disk.."}"] = tonumber(temp) end end |