From 2ece009273252437281c8cc0b84ba2ec49e5d07c Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 17 Oct 2013 19:07:53 +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. --- syslog-model.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'syslog-model.lua') diff --git a/syslog-model.lua b/syslog-model.lua index 08dacfc..8e3c665 100644 --- a/syslog-model.lua +++ b/syslog-model.lua @@ -1,4 +1,4 @@ -module(..., package.seeall) +local mymodule = {} modelfunctions = require("modelfunctions") fs = require("acf.fs") @@ -145,21 +145,21 @@ end -- ################################################################################ -- PUBLIC FUNCTIONS -function get_startstop(self, clientdata) +function mymodule.get_startstop(self, clientdata) return modelfunctions.get_startstop(processname) end -function startstop_service(self, startstop, action) +function mymodule.startstop_service(self, startstop, action) return modelfunctions.startstop_service(startstop, action) end -function getstatus() +function mymodule.getstatus() return modelfunctions.getstatus(processname, packagename, "Syslog Status") end -function getlogging() +function mymodule.getlogging() local status = {} - local opts = getconfig() + local opts = mymodule.getconfig() if (opts.value.remotelogging.value == "") or (opts.value.localandnetworklog.value) then status.logfile = cfe({ label="Locally logging to", @@ -176,11 +176,11 @@ function getlogging() return cfe({ type="group", value=status }) end -function get_filedetails() +function mymodule.get_filedetails() return modelfunctions.getfiledetails(configfile) end -function getconfig() +function mymodule.getconfig() local config = {} if (fs.is_file(configfile)) then local configcontent = format.opts_to_table(string.sub((format.parse_ini_file(fs.read_file(configfile) or "", "", "SYSLOGD_OPTS") or ""),2,-2)) @@ -193,7 +193,7 @@ function getconfig() return config end -function updateconfig (self, config) +function mymodule.updateconfig (self, config) local success = true success, config = validateconfig(config) @@ -206,6 +206,8 @@ function updateconfig (self, config) return config end -function update_filedetails (self, filedetails) +function mymodule.update_filedetails (self, filedetails) return modelfunctions.setfiledetails(self, filedetails, {configfile}, validate_configfile) end + +return mymodule -- cgit v1.2.3