From 99f69b51db21781c3775956cb03acb64b3cb7477 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 18 Oct 2013 19:58:50 +0000 Subject: 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. --- asterisk-model.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'asterisk-model.lua') 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 -- cgit v1.2.3