From 41cc2c0e27e6a0860d21754ed9d13f6cd61254ac Mon Sep 17 00:00:00 2001 From: Arvydas Sidorenko Date: Fri, 15 Jun 2012 18:07:05 +0200 Subject: Ported vicious.widgets module to lua 5.2 Signed-off-by: Arvydas Sidorenko Signed-off-by: Adrian C. (anrxc) --- widgets/pkg.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'widgets/pkg.lua') diff --git a/widgets/pkg.lua b/widgets/pkg.lua index 62d0ccb..9ec03c0 100644 --- a/widgets/pkg.lua +++ b/widgets/pkg.lua @@ -11,7 +11,8 @@ local setmetatable = setmetatable -- Pkg: provides number of pending updates on UNIX systems -module("vicious.widgets.pkg") +-- vicious.widgets.pkg +local pkg = {} -- {{{ Packages widget type @@ -31,16 +32,16 @@ local function worker(format, warg) } -- Check if updates are available - local pkg = manager[warg] - local f = io.popen(pkg.cmd) + local _pkg = manager[warg] + local f = io.popen(_pkg.cmd) for line in f:lines() do updates = updates + 1 end f:close() - return {pkg.sub and math.max(updates-pkg.sub, 0) or updates} + return {_pkg.sub and math.max(updates-_pkg.sub, 0) or updates} end -- }}} -setmetatable(_M, { __call = function(_, ...) return worker(...) end }) +return setmetatable(pkg, { __call = function(_, ...) return worker(...) end }) -- cgit v1.2.3