From 08093f7a2d4cee3dac4834d7d24c81c52a4b7ae2 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 18 Oct 2013 19:47:04 +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. --- amavis-controller.lua | 12 +++++++----- amavis-model.lua | 14 ++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/amavis-controller.lua b/amavis-controller.lua index 0648aac..d69fcc5 100644 --- a/amavis-controller.lua +++ b/amavis-controller.lua @@ -1,15 +1,17 @@ -module(..., package.seeall) +local mymodule = {} -default_action = "status" +mymodule.default_action = "status" -function status(self) +function mymodule.status(self) return self.model.getstatus() end -function startstop(self) +function mymodule.startstop(self) return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata) end -function expert(self) +function mymodule.expert(self) return self.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Amavis Config", "Configuration Set") end + +return mymodule diff --git a/amavis-model.lua b/amavis-model.lua index f35ed9a..b73a7e2 100644 --- a/amavis-model.lua +++ b/amavis-model.lua @@ -1,4 +1,4 @@ -module(..., package.seeall) +local mymodule = {} -- Load libraries modelfunctions = require("modelfunctions") @@ -16,22 +16,24 @@ local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin -- ################################################################################ -- 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, "Amavis Status") end -function get_filedetails() +function mymodule.get_filedetails() return modelfunctions.getfiledetails(configfile) end -function update_filedetails(self, filedetails) +function mymodule.update_filedetails(self, filedetails) return modelfunctions.setfiledetails(self, filedetails, {configfile}) end + +return mymodule -- cgit v1.2.3