diff options
author | Ted Trask <ttrask01@yahoo.com> | 2013-10-17 19:07:53 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2013-10-17 19:07:53 +0000 |
commit | 2ece009273252437281c8cc0b84ba2ec49e5d07c (patch) | |
tree | 1c082ee4891a4717f2fea09f0df4a8946d9fdb41 /rc-model.lua | |
parent | 0537a242f9709271454252e7897a7709144a3b02 (diff) | |
download | acf-alpine-baselayout-2ece009273252437281c8cc0b84ba2ec49e5d07c.tar.bz2 acf-alpine-baselayout-2ece009273252437281c8cc0b84ba2ec49e5d07c.tar.xz |
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.
Diffstat (limited to 'rc-model.lua')
-rw-r--r-- | rc-model.lua | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/rc-model.lua b/rc-model.lua index d799cca..3df75a2 100644 --- a/rc-model.lua +++ b/rc-model.lua @@ -1,4 +1,4 @@ -module (..., package.seeall) +local mymodule = {} posix = require("posix") modelfunctions = require("modelfunctions") @@ -16,7 +16,7 @@ table.sort(runlevels) local config -status = function() +mymodule.status = function() if not config then config = processinfo.read_initrunlevels() for i,c in pairs(config) do @@ -30,7 +30,7 @@ status = function() return cfe({ type="structure", value=config, label="Init Runlevels" }) end -read_runlevels = function(self, clientdata) +mymodule.read_runlevels = function(self, clientdata) local servicename = clientdata.servicename local value = {} value.servicename = cfe({ value=servicename or "", label="Service Name", seq=1 }) @@ -49,7 +49,7 @@ read_runlevels = function(self, clientdata) return cfe({ type="group", value=value, label="Service Runlevels"}) end -update_runlevels = function(self, service) +mymodule.update_runlevels = function(self, service) local success = modelfunctions.validatemulti(service.value.runlevels) service.value.servicename.errtxt = "Invalid service" for name in posix.files("/etc/init.d") do @@ -85,11 +85,12 @@ update_runlevels = function(self, service) return service end -function get_startstop(self, clientdata) +function mymodule.get_startstop(self, clientdata) return modelfunctions.get_startstop(clientdata.servicename) end -function startstop_service(self, startstop) +function mymodule.startstop_service(self, startstop) return modelfunctions.startstop_service(startstop, clientdata.action) end +return mymodule |