From fc996d5c5c994a13d81d336c9fbeda120685cc42 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 21 Oct 2013 00:55:30 +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. --- vlc-model.lua | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'vlc-model.lua') diff --git a/vlc-model.lua b/vlc-model.lua index aa9470f..e210e25 100644 --- a/vlc-model.lua +++ b/vlc-model.lua @@ -1,4 +1,4 @@ -module(..., package.seeall) +local mymodule = {} -- Load libraries modelfunctions = require("modelfunctions") @@ -11,7 +11,7 @@ local processname="vlc" local configfile = "/etc/conf.d/"..tostring(processname) local logfile = "/var/log/vlc/vlc.log" -function set_processname(p) +function mymodule.set_processname(p) processname = p configfile = "/etc/conf.d/"..tostring(processname) end @@ -24,24 +24,24 @@ 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, tostring(processname).." Status") end -function getconfigfile() +function mymodule.getconfigfile() -- FIXME Validate return modelfunctions.getfiledetails(configfile) end -function get_filedetails() +function mymodule.get_filedetails() local path=logfile local path2 if fs.is_file(configfile) then @@ -53,12 +53,13 @@ function get_filedetails() return modelfunctions.getfiledetails(path) end -function setconfigfile(self, filedetails) +function mymodule.setconfigfile(self, filedetails) -- FIXME Validate return modelfunctions.setfiledetails(self, filedetails, {configfile}) end -function getleases() +function mymodule.getleases() return modelfunctions.getfiledetails(leasefile) end +return mymodule -- cgit v1.2.3