summaryrefslogtreecommitdiffstats
path: root/lib/authenticator-plaintext.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-17 18:59:27 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-17 18:59:27 +0000
commitc0e0377e384c8167172ee06d8c11ef2f782522c7 (patch)
treebb89301e467ff61d93a39642354bcfe382571529 /lib/authenticator-plaintext.lua
parentfcaab1b363fcd5ff2dccce8f98cacabc5635ba5f (diff)
downloadacf-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 'lib/authenticator-plaintext.lua')
-rw-r--r--lib/authenticator-plaintext.lua20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/authenticator-plaintext.lua b/lib/authenticator-plaintext.lua
index caa6748..ecfca03 100644
--- a/lib/authenticator-plaintext.lua
+++ b/lib/authenticator-plaintext.lua
@@ -7,12 +7,12 @@ create a different file for each field.
]]--
-module (..., package.seeall)
+local mymodule = {}
fs = require("acf.fs")
posix = require("posix")
-list_fields = function(self, tabl)
+mymodule.list_fields = function(self, tabl)
if not self or not tabl or tabl == "" then
return {}
end
@@ -27,7 +27,7 @@ list_fields = function(self, tabl)
return fields
end
-read_field = function(self, tabl, field)
+mymodule.read_field = function(self, tabl, field)
if not self or not tabl or tabl == "" or not field then
return nil
end
@@ -53,7 +53,7 @@ read_field = function(self, tabl, field)
end
end
-delete_field = function(self, tabl, field)
+mymodule.delete_field = function(self, tabl, field)
if not self or not tabl or tabl == "" or not field then
return false
end
@@ -62,7 +62,7 @@ delete_field = function(self, tabl, field)
return true
end
-write_entry = function(self, tabl, field, id, entry)
+mymodule.write_entry = function(self, tabl, field, id, entry)
if not self or not tabl or tabl == "" or not field or not id or not entry then
return false
end
@@ -83,7 +83,7 @@ write_entry = function(self, tabl, field, id, entry)
return true
end
-read_entry = function(self, tabl, field, id)
+mymodule.read_entry = function(self, tabl, field, id)
if not self or not tabl or tabl == "" or not field or not id then
return nil
end
@@ -99,7 +99,7 @@ read_entry = function(self, tabl, field, id)
return nil
end
-delete_entry = function (self, tabl, field, id)
+mymodule.delete_entry = function (self, tabl, field, id)
if not self or not tabl or tabl == "" or not field or not id then
return false
end
@@ -123,11 +123,13 @@ delete_entry = function (self, tabl, field, id)
-- If deleting the main field, delete all other fields also
if field == "" then
- local fields = list_fields(self, tabl)
+ local fields = mymodule.list_fields(self, tabl)
for i,fld in ipairs(fields) do
- delete_entry(self, tabl, fld, id)
+ mymodule.delete_entry(self, tabl, fld, id)
end
end
return result
end
+
+return mymodule