From 8b49a54dfe53bbc68c89147f43d24f3be2d8e1b4 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sun, 20 Oct 2013 01:06:44 +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. --- pingu-controller.lua | 12 +++++++----- pingu-model.lua | 14 ++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pingu-controller.lua b/pingu-controller.lua index f70e7ac..f11d3d6 100644 --- a/pingu-controller.lua +++ b/pingu-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 Pingu Config", "Configuration Set") end + +return mymodule diff --git a/pingu-model.lua b/pingu-model.lua index 223bb3d..d81f903 100644 --- a/pingu-model.lua +++ b/pingu-model.lua @@ -1,4 +1,4 @@ -module(..., package.seeall) +local mymodule = {} -- Load libraries modelfunctions = require("modelfunctions") @@ -18,22 +18,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, "Pingu 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