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:10:47 +0200 |
commit | 4602ca2fa5e8e2e408713f72ae7e4cd14480bc01 (patch) | |
tree | bfbf75b8afd738f5a036737404f3eafe87586c66 /cpuinf.lua | |
parent | af4e85f99d0ac63127f19640ef47d768d7bed7cd (diff) | |
download | vicious-legacy-4602ca2fa5e8e2e408713f72ae7e4cd14480bc01.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 |