diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-11-17 14:38:05 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-11-17 14:39:08 -0800 |
| commit | 7f47d4204039258cec78c767f489b7809b4257ff (patch) | |
| tree | c8533068b75ab453accfe1f688705e9e94c9e279 /nomsu.lua | |
| parent | 34a3dd22a4e132bd4e0fe3ce89831c3fe761d3d9 (diff) | |
In-progress (but working) overhaul of some elements including: function
calls, lib/thing.nom API, multi-assignments, varargs, etc.
Diffstat (limited to 'nomsu.lua')
| -rw-r--r-- | nomsu.lua | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -202,12 +202,12 @@ run = function() for chunk_no, chunk in ipairs(tree) do local lua = nomsu_environment.compile(chunk) lua:declare_locals() - nomsu_environment.run_1_in(chunk, nomsu_environment) - output:write((chunk_no > 1) and '\n' or '', "-- File " .. tostring(filename) .. " chunk #" .. tostring(chunk_no) .. "\n") - output:write(tostring(lua), "\n") + lua:prepend((chunk_no > 1) and '\n' or '', "-- File " .. tostring(filename) .. " chunk #" .. tostring(chunk_no) .. "\n") if args.verbose then - print(tostring(lua)) + print(lua:text()) end + nomsu_environment.run_1_in(chunk, nomsu_environment) + output:write(lua:text(), "\n") end print(("Compiled %-25s -> %s"):format(filename, filename:gsub("%.nom$", ".lua"))) output:close() @@ -221,12 +221,12 @@ run = function() tree } end - for _index_1 = 1, #tree do - local chunk = tree[_index_1] + for chunk_no, chunk in ipairs(tree) do local lua = nomsu_environment.compile(chunk) lua:declare_locals() - nomsu_environment.run_1_in(chunk, nomsu_environment) - print(tostring(lua)) + lua:prepend((chunk_no > 1) and '\n' or '', "-- File " .. tostring(filename) .. " chunk #" .. tostring(chunk_no) .. "\n") + print(lua:text()) + nomsu_environment.run_1_in(lua, nomsu_environment) end else nomsu_environment.run_file_1_in(filename, nomsu_environment, 0) |
