diff options
author | Ted Trask <ttrask01@yahoo.com> | 2013-10-19 23:58:47 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2013-10-19 23:58:47 +0000 |
commit | cdc275fc78488777472445d5417dcc9e63b8b6b5 (patch) | |
tree | 2cc9f3f6b6d978c27de211d3194f43d76154db20 /qos-model.lua | |
parent | 7a83c842a9ae46a39e3f3f7b6373531cfe0ab58d (diff) | |
download | acf-iproute2-qos-cdc275fc78488777472445d5417dcc9e63b8b6b5.tar.bz2 acf-iproute2-qos-cdc275fc78488777472445d5417dcc9e63b8b6b5.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 'qos-model.lua')
-rw-r--r-- | qos-model.lua | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/qos-model.lua b/qos-model.lua index 8a30a7a..1afd2b2 100644 --- a/qos-model.lua +++ b/qos-model.lua @@ -1,4 +1,4 @@ -module(..., package.seeall) +local mymodule = {} -- Load libraries modelfunctions = require("modelfunctions") @@ -52,19 +52,19 @@ end -- ################################################################################ -- PUBLIC FUNCTIONS -function get_startstop(self, clientdata) +function mymodule.get_startstop(self, clientdata) return modelfunctions.get_startstop(clientdata.init) 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(nil, packagename, "QOS Status") end -function listinterfacedetails(self) +function mymodule.listinterfacedetails(self) local result = {} local interface for i,int in ipairs(list_interfaces(self)) do @@ -82,13 +82,13 @@ function listinterfacedetails(self) return cfe({ type="structure", value=result, label="QOS Interface List" }) end -function get_enable(self, clientdata) +function mymodule.get_enable(self, clientdata) local retval = {} retval.interface = cfe({ value=clientdata.interface or "", label="Interface" }) return cfe({ type="group", value=retval, label="Enable QOS on Interface" }) end -function enable(self, int_enable) +function mymodule.enable(self, int_enable) local interface = int_enable.value.interface.value local init = initfile.."."..interface int_enable.errtxt = "Failed to enable QOS" @@ -114,15 +114,15 @@ function enable(self, int_enable) return int_enable end -function get_filedetails(self, clientdata) +function mymodule.get_filedetails(self, clientdata) return modelfunctions.getfiledetails(clientdata.filename, validate_filename) end -function update_filedetails(self, filedetails) +function mymodule.update_filedetails(self, filedetails) return modelfunctions.setfiledetails(self, filedetails, validate_filename) end -function get_config(self, clientdata) +function mymodule.get_config(self, clientdata) local interface = clientdata.DEV local config = {} local ifbs = {""} @@ -154,7 +154,7 @@ function get_config(self, clientdata) return cfe({ type="group", value=config, label=interface.." QOS Config" }) end -function update_config(self, config) +function mymodule.update_config(self, config) local success = false config.value.DEV.errtxt = "Invalid device" for i,int in ipairs(list_interfaces(self)) do @@ -220,3 +220,5 @@ function update_config(self, config) return config end + +return mymodule |