copy how Lua 5.3 REPL prints expr values
[?]
Apr 26, 2022, 5:10 AM
O2UAHLOVG324OWG6YMZTZOL6ZPT7IU4JKZFHWWIMOFB74EK4KKUACDependencies
Change contents
- edit in mu.lua at line 7
-- unclear how Lua (post 5.2) is able to selectively print values of variables-- at the repl - replacement in mu.lua at line 34
local f, err = load(buf, 'REPL')local f, err = load('return '..buf, 'REPL') - replacement in mu.lua at line 47
stdscr:addstr(err..'\n')if string.match(err, "'<eof>'$") or string.match(err, "<eof>$") thenbuf = buf .. '\n'new_expr = falseelseprint(err)local f, err = load(buf, 'REPL')if f then - edit in mu.lua at line 51
local success, results = gather_results(xpcall(f, function(...) return debug.traceback() end))if success thenfor _, result in ipairs(results) doprint(result)endelseprint(results[1])endelsestdscr:addstr(err..'\n')if string.match(err, "'<eof>'$") or string.match(err, "<eof>$") thenbuf = buf .. '\n'new_expr = falseelseprint(err)buf = ''new_expr = trueend