aboutsummaryrefslogtreecommitdiff
path: root/widgets/pkg.lua
diff options
context:
space:
mode:
authorArvydas Sidorenko <asido4@gmail.com>2012-06-15 18:07:05 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2012-06-18 01:26:31 +0200
commit41cc2c0e27e6a0860d21754ed9d13f6cd61254ac (patch)
tree20ed8fe7b878caec0c9e033168fe79561f31db57 /widgets/pkg.lua
parentb6b52900930ddb2a5b958a6d314766b455358164 (diff)
downloadvicious-legacy-41cc2c0e27e6a0860d21754ed9d13f6cd61254ac.tar.xz
Ported vicious.widgets module to lua 5.2
Signed-off-by: Arvydas Sidorenko <asido4@gmail.com> Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Diffstat (limited to 'widgets/pkg.lua')
-rw-r--r--widgets/pkg.lua11
1 files changed, 6 insertions, 5 deletions
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 })