diff options
author | Ted Trask <ttrask01@yahoo.com> | 2012-04-24 18:19:58 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2012-04-24 18:19:58 +0000 |
commit | 6e8248105c4089fe57472fcf91f15a0b408434c8 (patch) | |
tree | 7743b055924618299e7e2b3c56ffe2df8228a6c2 | |
parent | a6d2a2c219266dc8be5233e172597fbb396f5bd2 (diff) | |
download | acf-core-6e8248105c4089fe57472fcf91f15a0b408434c8.tar.bz2 acf-core-6e8248105c4089fe57472fcf91f15a0b408434c8.tar.xz |
Require modelfunctions setfiledetails and write_file_with_audit to take self parameter
-rw-r--r-- | lib/modelfunctions.lua | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/lib/modelfunctions.lua b/lib/modelfunctions.lua index 49f040d..9ec5a34 100644 --- a/lib/modelfunctions.lua +++ b/lib/modelfunctions.lua @@ -111,7 +111,7 @@ function getfiledetails(file, validatefilename, validatefiledetails) return filedetails end -function setfiledetails(filedetails, validatefilename, validatefiledetails) +function setfiledetails(self, filedetails, validatefilename, validatefiledetails) filedetails.value.filecontent.value = string.gsub(format.dostounix(filedetails.value.filecontent.value), "\n+$", "") local success = true if type(validatefilename) == "function" then @@ -134,7 +134,7 @@ function setfiledetails(filedetails, validatefilename, validatefiledetails) end if success then --fs.write_file(filedetails.value.filename.value, filedetails.value.filecontent.value) - write_file_with_audit(filedetails.value.filename.value, filedetails.value.filecontent.value) + write_file_with_audit(self, filedetails.value.filename.value, filedetails.value.filecontent.value) filedetails = getfiledetails(filedetails.value.filename.value) else filedetails.errtxt = "Failed to set file" @@ -174,21 +174,6 @@ function validatemulti(multi) end function write_file_with_audit (self, path, str) - -- if there are only two parameters, assume self was omitted - if not str then - str = path - path = self - self = nil - end - -- attempt to find self - if not self then - if SELF and #SELF > 0 then - self = SELF[#SELF] - elseif APP then - self = APP - end - end - if self then local pre = "" local post = "" |