From 4602ca2fa5e8e2e408713f72ae7e4cd14480bc01 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Mon, 5 Oct 2009 00:10:47 +0200 Subject: Lots of coding style changes --- cpu.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cpu.lua') diff --git a/cpu.lua b/cpu.lua index 73250ee..9dabb7f 100644 --- a/cpu.lua +++ b/cpu.lua @@ -10,6 +10,10 @@ local io = { open = io.open } local setmetatable = setmetatable local math = { floor = math.floor } local table = { insert = table.insert } +local string = { + find = string.find, + gmatch = string.gmatch +} -- }}} @@ -29,13 +33,13 @@ local function worker(format) local cpu_lines = {} for line in f:lines() do - if line:find("^cpu") then + if string.find(line, "^cpu") then if #cpu_lines < 1 then cpuid = 1 else cpuid = #cpu_lines + 1 end cpu_lines[cpuid] = {} - for match in line:gmatch("[%s]+([%d]+)") do - table.insert(cpu_lines[cpuid], match) + for i in string.gmatch(line, "[%s]+([%d]+)") do + table.insert(cpu_lines[cpuid], i) end end end -- cgit v1.2.3