diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-05 00:10:47 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-05 00:13:38 +0200 |
commit | d81eed6d310bce28b3709980d80c433a04eefaae (patch) | |
tree | 3ab65939b04a86d22e39ad6a4a5ac3ab122257b8 /cpuinf.lua | |
parent | c2b68ad3e78e366e611600f54dcfa8d760ed026f (diff) | |
download | vicious-legacy-d81eed6d310bce28b3709980d80c433a04eefaae.tar.xz |
Lots of coding style changes
Diffstat (limited to 'cpuinf.lua')
-rw-r--r-- | cpuinf.lua | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -7,6 +7,7 @@ local tonumber = tonumber local io = { open = io.open } local setmetatable = setmetatable +local string = { match = string.match } -- }}} @@ -22,14 +23,14 @@ local function worker(format) local cpu_info = {} for line in f:lines() do - if line:match("^processor.*") then - cpu_id = line:match("([%d]+)") - elseif line:match("^cpu MHz.*") then - local cpu_speed = line:match("([%d]+)%.") + if string.match(line, "^processor.*") then + cpu_id = string.match(line, "([%d]+)") + elseif string.match(line, "^cpu MHz.*") then + local cpu_speed = string.match(line, "([%d]+)%.") cpu_info["{cpu"..cpu_id.." mhz}"] = cpu_speed cpu_info["{cpu"..cpu_id.." ghz}"] = tonumber(cpu_speed) / 1000 - elseif line:match("^cache size.*") then - local cpu_cache = line:match("([%d]+)[%s]KB") + elseif string.match(line, "^cache size.*") then + local cpu_cache = string.match(line, "([%d]+)[%s]KB") cpu_info["{cpu"..cpu_id.." kb}"] = cpu_cache cpu_info["{cpu"..cpu_id.." mb}"] = tonumber(cpu_cache) / 1024 end |