little Lua repl on hitting ctrl-r
[?]
May 2, 2022, 2:21 PM
6Q6XGOFLRHPFQPVUKYTRWS4BKJ6G65IUWSS7HBQKV5HYZDEYCICACDependencies
Change contents
- edit in main.lua at line 36
-- do nothingelseif key == 'lshift' or key == 'rshift' then - replacement in main.lua at line 40
lines[#lines] = lines[#lines]..' aaa'if key == 'r' thenlines[#lines+1] = eval(lines[#lines])[1]lines[#lines+1] = ''end - edit in main.lua at line 49
function eval(buf)local f = load('return '..buf, 'REPL')if f thenreturn call_gather(f)endlocal f, err = load(buf, 'REPL')if f thenreturn call_gather(f)elsereturn {err}endend-- based on https://github.com/hoelzro/lua-replfunction call_gather(f)local success, results = gather_results(xpcall(f, function(...) return debug.traceback() end))return resultsendfunction gather_results(success, ...)local n = select('#', ...)return success, { n = n, ... }end