diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-07 21:41:59 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-07 21:42:26 -0800 |
| commit | 2048d4468acf4720c38eabe5644e9f112cea5478 (patch) | |
| tree | 30643f7ff961cb704432ae29c77a3e97f7d6c81d | |
| parent | eda80cf575caaf008d0f9e8d80fe70e9f5ff8f83 (diff) | |
Added quit/exit and switched Files.read->exists.
| -rw-r--r-- | nomsu_environment.lua | 4 | ||||
| -rw-r--r-- | nomsu_environment.moon | 4 | ||||
| -rwxr-xr-x | tools/repl.nom | 1 |
3 files changed, 5 insertions, 4 deletions
diff --git a/nomsu_environment.lua b/nomsu_environment.lua index ca22389..51100fc 100644 --- a/nomsu_environment.lua +++ b/nomsu_environment.lua @@ -137,6 +137,8 @@ local nomsu_environment = Importer({ compile_error_at = compile_error, _1_forked = _1_forked, import_to_1_from = import_to_1_from, + exit = os.exit, + quit = os.exit, _1_parsed = function(nomsu_code, syntax_version) if type(nomsu_code) == 'string' then local filename = Files.spoof(nomsu_code) @@ -333,7 +335,7 @@ local nomsu_environment = Importer({ break end local code - if optimization ~= 0 and Files.read(lua_filename) then + if optimization ~= 0 and Files.exists(lua_filename) then local file = Files.read(lua_filename) code = LuaCode:from(Source(filename, 1, #file), file) else diff --git a/nomsu_environment.moon b/nomsu_environment.moon index 5d7a02c..a5b1169 100644 --- a/nomsu_environment.moon +++ b/nomsu_environment.moon @@ -58,7 +58,7 @@ nomsu_environment = Importer{ -- Nomsu functions: _1_as_nomsu:tree_to_nomsu, _1_as_inline_nomsu:tree_to_inline_nomsu, compile: compile, _1_as_lua: compile, compile_error_at:compile_error, - :_1_forked, :import_to_1_from, + :_1_forked, :import_to_1_from, exit:os.exit, quit:os.exit, _1_parsed: (nomsu_code, syntax_version)-> if type(nomsu_code) == 'string' @@ -185,7 +185,7 @@ nomsu_environment = Importer{ did_anything = true continue -- TODO: don't automatically use precompiled version? - code = if optimization != 0 and Files.read(lua_filename) + code = if optimization != 0 and Files.exists(lua_filename) -- TODO: use a checksum? file = Files.read(lua_filename) LuaCode\from(Source(filename, 1, #file), file) diff --git a/tools/repl.nom b/tools/repl.nom index c35abc5..58a24d3 100755 --- a/tools/repl.nom +++ b/tools/repl.nom @@ -7,7 +7,6 @@ use "lib/os.nom" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -externally [quit, exit] all mean: lua> "os.exit(0)" externally (help) means: say (" This is the Nomsu v\(Nomsu version) interactive console. |
