summaryrefslogtreecommitdiffstats
path: root/apk.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-17 19:03:48 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-17 19:03:48 +0000
commitd60a739470dc0d46f5306033b17c1dd27ddc37fc (patch)
treeb59f28794de88f78edf2a4b3c381d5aed2a32550 /apk.lua
parent75117b54d8a43b94b7a6ff797cce06af1647a7aa (diff)
downloadacf-lib-d60a739470dc0d46f5306033b17c1dd27ddc37fc.tar.bz2
acf-lib-d60a739470dc0d46f5306033b17c1dd27ddc37fc.tar.xz
Remove all calls to 'module' in preparation for move to Lua 5.2
Use mymodule parameter for module definition. This was also helpful in revealing places where the code relied on the global environment.
Diffstat (limited to 'apk.lua')
-rw-r--r--apk.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/apk.lua b/apk.lua
index 9e1b37f..d6b1fd6 100644
--- a/apk.lua
+++ b/apk.lua
@@ -1,9 +1,9 @@
-- apk library
-module (..., package.seeall)
+local mymodule = {}
-subprocess = require("subprocess")
+mymodule.subprocess = require("subprocess")
-delete = function(package)
+mymodule.delete = function(package)
local success = false
local code, cmdresult = subprocess.call_capture({"apk", "del", package, stderr=subprocess.STDOUT})
if string.find(cmdresult, "^OK") then
@@ -14,7 +14,7 @@ delete = function(package)
return success, cmdresult
end
-install = function(package)
+mymodule.install = function(package)
local success = true
local code, cmdresult = subprocess.call_capture({"apk", "add", package, stderr=subprocess.STDOUT})
if string.find(cmdresult, "^ERROR") then
@@ -23,10 +23,12 @@ install = function(package)
return success, cmdresult
end
-version = function(package)
+mymodule.version = function(package)
local code, cmdresult = subprocess.call_capture({"apk", "info", "-ve", package, stderr=subprocess.STDOUT})
if string.find(cmdresult, "^%s*$") then
cmdresult = nil
end
return cmdresult
end
+
+return mymodule