summaryrefslogtreecommitdiffstats
path: root/opennhrp-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-20 00:37:15 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-20 00:37:15 +0000
commit6a0cfe40de67399119a4a689cd0c0a9e62ef8fee (patch)
tree1e55e0b848670a8c90f227d60897954fcc12bb74 /opennhrp-model.lua
parentf4818065de65fde4b2a76f1ea0c13e92fb448822 (diff)
downloadacf-opennhrp-6a0cfe40de67399119a4a689cd0c0a9e62ef8fee.tar.bz2
acf-opennhrp-6a0cfe40de67399119a4a689cd0c0a9e62ef8fee.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 'opennhrp-model.lua')
-rw-r--r--opennhrp-model.lua22
1 files changed, 12 insertions, 10 deletions
diff --git a/opennhrp-model.lua b/opennhrp-model.lua
index 29f2e1f..c9a8e4c 100644
--- a/opennhrp-model.lua
+++ b/opennhrp-model.lua
@@ -1,4 +1,4 @@
-module(..., package.seeall)
+local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
@@ -179,19 +179,19 @@ 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, "OpenNHRP Status")
end
-function getshowreport()
+function mymodule.getshowreport()
local peers_list = cfe({ type="structure", value={}, label="Peers" })
local opennhrpstatus = cfe({ value="Show report not available", label="Status" })
local content = modelfunctions.run_executable({"opennhrpctl", "show"})
@@ -218,7 +218,7 @@ function getshowreport()
return cfe({ type="group", value={peers_list=peers_list, status=opennhrpstatus}, label="OpenNHRP Show Report" })
end
-function getinterfacedetails(interface)
+function mymodule.getinterfacedetails(interface)
local details = {}
details.interface = cfe({ value=interface, label="Interface" })
details.type = cfe({ type="select", value="Unused", label="Interface type", option={"Unused", "NHRP Enabled", "Shortcut Destination"} })
@@ -245,7 +245,7 @@ function getinterfacedetails(interface)
return cfe({ type="group", value=details, label="OpenNHRP Interface Configuration" })
end
-function updateinterfacedetails(self, interfacedetails)
+function mymodule.updateinterfacedetails(self, interfacedetails)
local success, interfacedetails = validateinterfacedetails(interfacedetails)
if success then
@@ -298,7 +298,7 @@ function updateinterfacedetails(self, interfacedetails)
return interfacedetails
end
-function listinterfaces(self)
+function mymodule.listinterfaces(self)
local interfaces = {}
list_interfaces(self)
configfilecontent = configfilecontent or fs.read_file(configfile) or ""
@@ -328,11 +328,11 @@ function listinterfaces(self)
return cfe({ type="structure", value=interfaces, label="OpenNHRP Interfaces" })
end
-function getconfigfile(self)
+function mymodule.getconfigfile(self)
return validateconfigfile(self, modelfunctions.getfiledetails(configfile))
end
-function setconfigfile(self, filedetails)
+function mymodule.setconfigfile(self, filedetails)
filedetails = modelfunctions.setfiledetails(self, filedetails, {configfile})
if not filedetails.errtxt then
configfilecontent = nil
@@ -340,3 +340,5 @@ function setconfigfile(self, filedetails)
end
return validateconfigfile(self, filedetails)
end
+
+return mymodule