delete an ancient, unused file
[?]
May 15, 2022, 9:38 PM
T4FRZSYLUWDA4K3URU4MI33EGD4XWSM7FPSIRNMAEYQAFEDFGPZACDependencies
- [2]
M7W3VZ5M. - [3]
QCLPIXMPextract a function - [4]
R5QXEHUIsomebody stop me - [5]
6IQOBYPTrepl - [6]
6LJZN727handle chords - [7]
XX7G2FFJintermingle freehand line drawings with text - [8]
OTIBCAUJlove2d scaffold - [9]
D2GCFTTTclean up repl functionality - [10]
O2UAHLOVcopy how Lua 5.3 REPL prints expr values - [11]
RSZD5A7Gforgot to add json.lua - [12]
SKYULYLCstop mixing ncurses with print
Change contents
- file deletion: mu.lua
curses = require 'curses'local stdscr = curses.initscr()stdscr:clear()curses.endwin()stdscr:scrollok(true)local function readline()local result = ''while true dolocal x = stdscr:getch()stdscr:addch(x)local c = string.char(x)result = result .. cif c == '\n' then break endendreturn resultendlocal new_expr = truelocal buf = ''while true doif new_expr thenstdscr:addstr('> ')elsestdscr:addstr('>> ')endbuf = buf .. readline()if f thenbuf = ''new_expr = trueelsebuf = ''new_expr = trueelseif string.match(err, "'<eof>'$") or string.match(err, "<eof>$") thenbuf = buf .. '\n'new_expr = falseelsebuf = ''new_expr = trueendstdscr:addstr(err..'\n')endendendeval_print(f)local f, err = load(buf, 'REPL')if f theneval_print(f)local f = load('return '..buf, 'REPL')-- print value of expression the way Lua 5.3 does it: by prepending 'return' to the line-- based on https://github.com/hoelzro/lua-replfunction eval_print(f)local success, results = gather_results(xpcall(f, function(...) return debug.traceback() end))if success thenfor i, result in ipairs(results) doif i > 1 thenstdscr:addch('\t')endstdscr:addstr(tostring(result))endelsestdscr:addstr(tostring(result[1]))endstdscr:addch('\n')endendlocal function gather_results(success, ...)local n = select('#', ...)return success, { n = n, ... }curses.echo(false) -- unclear why implicit echo can't handle newlines, regardless of stdscr:nl()