From 36a4fe6c80eb77f97fc6c2b5f820e6b9d458dc2e Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 25 Oct 2013 23:19:16 +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. --- postgresql-controller.lua | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'postgresql-controller.lua') diff --git a/postgresql-controller.lua b/postgresql-controller.lua index c1af2c5..2a61370 100644 --- a/postgresql-controller.lua +++ b/postgresql-controller.lua @@ -1,28 +1,31 @@ -module(..., package.seeall) +local mymodule = {} -mvc = {} -mvc.on_load = function(self, parent) +-- Use on_load function to handle multiple instances of this ACF (i.e. postgresql2) +mymodule.mvc = {} +mymodule.mvc.on_load = function(self, parent) self.model.set_processname(string.match(self.conf.prefix, "[^/]+")) end -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 details(self) +function mymodule.details(self) return self.model.getstatusdetails() end -function listfiles(self) +function mymodule.listfiles(self) return self.model.getfilelist() end -function expert(self) +function mymodule.expert(self) return self.handle_form(self, function() return self.model.getfiledetails(self.clientdata.filename) end, self.model.updatefiledetails, self.clientdata, "Save", "Edit Postgresql File", "File Saved") end + +return mymodule -- cgit v1.2.3