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.lua | |
| parent | 7f47d4204039258cec78c767f489b7809b4257ff (diff) | |
Tweaks and API cleanup.
Diffstat (limited to 'nomsu_environment.lua')
| -rw-r--r-- | nomsu_environment.lua | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/nomsu_environment.lua b/nomsu_environment.lua index 74a5bc1..7b26852 100644 --- a/nomsu_environment.lua +++ b/nomsu_environment.lua @@ -296,23 +296,41 @@ local nomsu_environment = Importer({ end _currently_running_files:add(path) local mod = _1_forked(environment) - for _, filename in Files.walk(path) do + for nomsupath in package.nomsupath:gmatch("[^;]+") do local _continue_0 = false repeat - if not (filename == "stdin" or filename:match("%.nom$")) then - _continue_0 = true + do + local files = Files.list(nomsupath .. "/" .. path) + if not (files) then + _continue_0 = true + break + end + for _index_0 = 1, #files do + local _continue_1 = false + repeat + local filename = files[_index_0] + if not (filename == "stdin" or filename:match("%.nom$")) then + _continue_1 = true + break + end + local lua_filename = filename:gsub("%.nom$", ".lua") + local code + if optimization ~= 0 and Files.read(lua_filename) then + local file = Files.read(lua_filename) + code = LuaCode:from(Source(filename, 1, #file), file) + else + local file = Files.read(filename) + code = NomsuCode:from(Source(filename, 1, #file), file) + end + environment.run_1_in(code, mod) + _continue_1 = true + until true + if not _continue_1 then + break + end + end break end - local lua_filename = filename:gsub("%.nom$", ".lua") - local code - if optimization ~= 0 and Files.read(lua_filename) then - local file = Files.read(lua_filename) - code = LuaCode:from(Source(filename, 1, #file), file) - else - local file = Files.read(filename) - code = NomsuCode:from(Source(filename, 1, #file), file) - end - environment.run_1_in(code, mod) _continue_0 = true until true if not _continue_0 then |
