From 09265504dcfe45d9683ffa7d3abc1570a55afb2a Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sun, 20 Oct 2013 00:32:59 +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. --- lvm2-controller.lua | 12 +++++++----- lvm2-model.lua | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lvm2-controller.lua b/lvm2-controller.lua index 23ea1b0..770dffe 100644 --- a/lvm2-controller.lua +++ b/lvm2-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 details(self) +function mymodule.details(self) return self.model.getstatusdetails() end + +return mymodule diff --git a/lvm2-model.lua b/lvm2-model.lua index ba63301..1676897 100644 --- a/lvm2-model.lua +++ b/lvm2-model.lua @@ -1,4 +1,4 @@ -module(..., package.seeall) +local mymodule = {} -- Load libraries modelfunctions = require("modelfunctions") @@ -15,19 +15,19 @@ local packagename = "lvm2" -- ################################################################################ -- 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, "LVM Status") end -function getstatusdetails() +function mymodule.getstatusdetails() local status = {} status.pvdisplay = cfe({ type="longtext", label="Physical Volumes" }) status.pvdisplay.value, status.pvdisplay.errtxt = modelfunctions.run_executable({"pvdisplay"}) @@ -37,3 +37,5 @@ function getstatusdetails() return cfe({ type="group", value=status, label="LVM Status Details" }) end + +return mymodule -- cgit v1.2.3