From 83219f8522271ae4f278abc5687921cc8267bb33 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 31 Oct 2018 03:51:37 -0700 Subject: Bumped version number, fixed REPL, and simplified/fixed (use %). --- files.moon | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'files.moon') diff --git a/files.moon b/files.moon index becc3fb..e0fe02b 100644 --- a/files.moon +++ b/files.moon @@ -33,7 +33,6 @@ Files.read = (filename)-> _FILE_CACHE[filename] = contents return contents --- `walk` returns an iterator over all files matching a path. {:match, :gsub} = string -- TODO: improve sanitization @@ -108,12 +107,9 @@ Files.walk = (path, flush_cache=false)-> else for nomsupath in package.nomsupath\gmatch("[^;]+") if files = browse(nomsupath.."/"..path) then break - iter = (files, i)-> - return unless files - i += 1 - if f = files[i] - return i, f - return iter, files, 0 + files or= {} + files = [gsub(f, "^%./", "") for f in *files] + return ipairs(files) line_counter = re.compile([[ lines <- {| line (%nl line)* |} -- cgit v1.2.3