From: copycat-killer Date: Sat, 19 Sep 2015 08:44:38 +0000 (+0200) Subject: #141 make battery table local to worker X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/29983d95b27b2b455903d90f72a68035b7563ffd?ds=sidebyside;hp=--cc #141 make battery table local to worker --- 29983d95b27b2b455903d90f72a68035b7563ffd diff --git a/widgets/bat.lua b/widgets/bat.lua index 626239b..61828ec 100644 --- a/widgets/bat.lua +++ b/widgets/bat.lua @@ -21,9 +21,9 @@ local setmetatable = setmetatable -- Battery infos -- lain.widgets.bat -local bat = {} local function worker(args) + local bat = {} local args = args or {} local timeout = args.timeout or 30 local battery = args.battery or "BAT0" @@ -143,7 +143,7 @@ local function worker(args) newtimer(battery, timeout, update) - return bat.widget + return setmetatable(bat, { __index = bat.widget }) end -return setmetatable(bat, { __call = function(_, ...) return worker(...) end }) +return setmetatable({}, { __call = function(_, ...) return worker(...) end })