diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-11-19 17:21:08 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-11-19 17:21:17 -0800 |
| commit | acd1191fb06a51f70f553c1dc8b47cf245a1c913 (patch) | |
| tree | 993bb69cc050426644b98d10fb1a3133b3623be6 /nomsu_environment.moon | |
| parent | 7f47d4204039258cec78c767f489b7809b4257ff (diff) | |
Tweaks and API cleanup.
Diffstat (limited to 'nomsu_environment.moon')
| -rw-r--r-- | nomsu_environment.moon | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/nomsu_environment.moon b/nomsu_environment.moon index cfcb15f..9dab5e9 100644 --- a/nomsu_environment.moon +++ b/nomsu_environment.moon @@ -168,17 +168,22 @@ nomsu_environment = Importer{ error("Circular import detected:\n "..circle\joined_with("\n..imports ")) _currently_running_files\add path mod = _1_forked(environment) - for _,filename in Files.walk(path) - continue unless filename == "stdin" or filename\match("%.nom$") - lua_filename = filename\gsub("%.nom$", ".lua") - -- TODO: don't automatically use precompiled version? - code = if optimization != 0 and Files.read(lua_filename) - file = Files.read(lua_filename) - LuaCode\from(Source(filename, 1, #file), file) - else - file = Files.read(filename) - NomsuCode\from(Source(filename, 1, #file), file) - environment.run_1_in(code, mod) + + for nomsupath in package.nomsupath\gmatch("[^;]+") + files = Files.list(nomsupath.."/"..path) + continue unless files + for filename in *files + continue unless filename == "stdin" or filename\match("%.nom$") + lua_filename = filename\gsub("%.nom$", ".lua") + -- TODO: don't automatically use precompiled version? + code = if optimization != 0 and Files.read(lua_filename) + file = Files.read(lua_filename) + LuaCode\from(Source(filename, 1, #file), file) + else + file = Files.read(filename) + NomsuCode\from(Source(filename, 1, #file), file) + environment.run_1_in(code, mod) + break import_to_1_from(environment, mod, prefix) environment.FILE_CACHE[path] = mod _currently_running_files\remove! |
