diff options
author | Mike Mason <ms13sp@gmail.com> | 2007-11-22 17:04:02 +0000 |
---|---|---|
committer | Mike Mason <ms13sp@gmail.com> | 2007-11-22 17:04:02 +0000 |
commit | 65461dce7f8de33ca4c61a855876ac11cda4e825 (patch) | |
tree | 2baadaf9aaa8a047ab86bec59267d91a4d174a7d /lib | |
parent | 38270a89a9a044005f949f5b73bf55c54117dbdd (diff) | |
download | acf-core-65461dce7f8de33ca4c61a855876ac11cda4e825.tar.bz2 acf-core-65461dce7f8de33ca4c61a855876ac11cda4e825.tar.xz |
Added ipairs_string to go through a table and make it a string. Easier to write to a file with write_file
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@357 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fs.lua | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -85,6 +85,19 @@ lines[#lines + 1] = c end return lines end +--will interate over a ipairs(table) and make it into a string to be used by write_file +function ipairs_string ( t ) + for a,b in ipairs(t) do + if a == 1 then + c = b + else + c = c .. "\n" .. b + end + end + --add a friendly \n for EOF + c = c .. "\n" + return c +end -- write a string to a file !! MM-will replace file contents @@ -111,6 +124,8 @@ function write_line_file ( path, str ) end + + -- iterator function for finding dir entries matching filespec (what) -- starting at where, or currentdir if not specified. -- Finds regexes, not fileglobs |