From 65461dce7f8de33ca4c61a855876ac11cda4e825 Mon Sep 17 00:00:00 2001 From: Mike Mason Date: Thu, 22 Nov 2007 17:04:02 +0000 Subject: 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 --- lib/fs.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/fs.lua') diff --git a/lib/fs.lua b/lib/fs.lua index 48364a6..88df9f1 100644 --- a/lib/fs.lua +++ b/lib/fs.lua @@ -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 -- cgit v1.2.3