diff options
author | Ted Trask <ttrask01@yahoo.com> | 2013-10-17 18:59:27 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2013-10-17 18:59:27 +0000 |
commit | c0e0377e384c8167172ee06d8c11ef2f782522c7 (patch) | |
tree | bb89301e467ff61d93a39642354bcfe382571529 /app/acf_cli-controller.lua | |
parent | fcaab1b363fcd5ff2dccce8f98cacabc5635ba5f (diff) | |
download | acf-core-c0e0377e384c8167172ee06d8c11ef2f782522c7.tar.bz2 acf-core-c0e0377e384c8167172ee06d8c11ef2f782522c7.tar.xz |
Remove all calls to 'module' in preparation for move to Lua 5.2
Use mymodule parameter for module definition.
This was also helpfule in revealing places where the code relied on the global environment.
Diffstat (limited to 'app/acf_cli-controller.lua')
-rw-r--r-- | app/acf_cli-controller.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/acf_cli-controller.lua b/app/acf_cli-controller.lua index 1828d10..7b706c3 100644 --- a/app/acf_cli-controller.lua +++ b/app/acf_cli-controller.lua @@ -1,12 +1,12 @@ -module(..., package.seeall) +local mymodule = {} posix = require("posix") session = require("session") local parent_exception_handler -mvc = {} -mvc.on_load = function (self, parent) +mymodule.mvc = {} +mymodule.mvc.on_load = function (self, parent) -- Make sure we have some kind of sane defaults for libdir self.conf.libdir = self.conf.libdir or ( string.match(self.conf.appdir, "[^,]+/") .. "/lib/" ) self.conf.script = "" @@ -22,12 +22,12 @@ mvc.on_load = function (self, parent) self.session = {} end -exception_handler = function (self, message ) +mymodule.exception_handler = function (self, message ) print(session.serialize("exception", message)) parent_exception_handler(self, message) end -handle_clientdata = function(form, clientdata, group) +mymodule.handle_clientdata = function(form, clientdata, group) clientdata = clientdata or {} form.errtxt = nil for n,value in pairs(form.value) do @@ -35,7 +35,7 @@ handle_clientdata = function(form, clientdata, group) local name = n if group then name = group.."."..name end if value.type == "group" then - handle_clientdata(value, clientdata, name) + mymodule.handle_clientdata(value, clientdata, name) -- Don't update from the default unless a value exists elseif value.type == "boolean" and clientdata[name] then value.value = (clientdata[name] == "true") @@ -56,3 +56,5 @@ handle_clientdata = function(form, clientdata, group) end end end + +return mymodule |