summaryrefslogtreecommitdiffstats
path: root/asterisk-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-18 19:58:50 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-18 19:58:50 +0000
commit99f69b51db21781c3775956cb03acb64b3cb7477 (patch)
treed5ce210f9a8587ecedb8663dedc021e5940d07fc /asterisk-model.lua
parent1d6fcde83bef7e14fd81d2d9c7425f33b39a6604 (diff)
downloadacf-asterisk-99f69b51db21781c3775956cb03acb64b3cb7477.tar.bz2
acf-asterisk-99f69b51db21781c3775956cb03acb64b3cb7477.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 'asterisk-model.lua')
-rw-r--r--asterisk-model.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/asterisk-model.lua b/asterisk-model.lua
index 5ce9dd4..6858e6f 100644
--- a/asterisk-model.lua
+++ b/asterisk-model.lua
@@ -1,5 +1,5 @@
-- Copyright(c) 2007 A. Brodmann - Licensed under terms of GPL2
-module (..., package.seeall)
+local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
@@ -24,23 +24,23 @@ end
-- ################################################################################
-- PUBLIC FUNCTIONS
-get_status = function()
+mymodule.get_status = function()
return modelfunctions.getstatus(processname, packagename, "Asterisk Status")
end
-function get_startstop(self, clientdata)
+mymodule.get_startstop = function(self, clientdata)
return modelfunctions.get_startstop(processname)
end
-function startstop_service(self, startstop, action)
+mymodule.startstop_service = function(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
-get_file = function(self, clientdata)
+mymodule.get_file = function(self, clientdata)
return modelfunctions.getfiledetails(clientdata.filename, is_valid_filename)
end
-update_file = function(self, filedetails)
+mymodule.update_file = function(self, filedetails)
local ret = modelfunctions.setfiledetails(self, filedetails, is_valid_filename)
if not ret.errtxt then
posix.chmod(filedetails.value.filename.value, "rw-------")
@@ -49,7 +49,7 @@ update_file = function(self, filedetails)
return ret
end
-list_files = function()
+mymodule.list_files = function()
local retval = {}
for file in fs.find(null, baseurl) do
local details = fs.stat(file)
@@ -61,3 +61,5 @@ list_files = function()
table.sort(retval, function(a,b) return a.filename < b.filename end)
return cfe({ type="structure", value=retval, label="List of Asterisk files" })
end
+
+return mymodule