From d81eed6d310bce28b3709980d80c433a04eefaae 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 --- batat.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'batat.lua') diff --git a/batat.lua b/batat.lua index b160dc7..2e40d9f 100644 --- a/batat.lua +++ b/batat.lua @@ -7,6 +7,7 @@ local io = { popen = io.popen } local setmetatable = setmetatable local table = { insert = table.insert } +local string = { match = string.match } -- }}} @@ -30,12 +31,12 @@ local function worker(format) for line in f:lines() do -- Check if the battery is present - if line:match("^[%s]+Battery.*") then + if string.match(line, "^[%s]+Battery.*") then -- Store state and charge information - table.insert(battery_info, (battery_state[line:match("([%a]*),")] or "/")) - table.insert(battery_info, (line:match("([%d]?[%d]?[%d])%.") or "/")) + table.insert(battery_info, (battery_state[string.match(line, "([%a]*),")] or "/")) + table.insert(battery_info, (string.match(line, "([%d]?[%d]?[%d])%.") or "/")) -- Store remaining time information - table.insert(battery_info, (line:match("%%,%s(.*)") or "/")) + table.insert(battery_info, (string.match(line, "%%,%s(.*)") or "/")) else return {"/", "/", "/"} end -- cgit v1.2.3