#141 make battery table local to worker

This commit is contained in:
copycat-killer 2015-09-19 10:44:38 +02:00
parent c886c5497d
commit 29983d95b2
1 changed files with 3 additions and 3 deletions

View File

@ -21,9 +21,9 @@ local setmetatable = setmetatable
-- Battery infos -- Battery infos
-- lain.widgets.bat -- lain.widgets.bat
local bat = {}
local function worker(args) local function worker(args)
local bat = {}
local args = args or {} local args = args or {}
local timeout = args.timeout or 30 local timeout = args.timeout or 30
local battery = args.battery or "BAT0" local battery = args.battery or "BAT0"
@ -143,7 +143,7 @@ local function worker(args)
newtimer(battery, timeout, update) newtimer(battery, timeout, update)
return bat.widget return setmetatable(bat, { __index = bat.widget })
end end
return setmetatable(bat, { __call = function(_, ...) return worker(...) end }) return setmetatable({}, { __call = function(_, ...) return worker(...) end })