little Lua repl on hitting ctrl-r

[?]
May 2, 2022, 2:21 PM
6Q6XGOFLRHPFQPVUKYTRWS4BKJ6G65IUWSS7HBQKV5HYZDEYCICAC

Dependencies

Change contents

  • edit in main.lua at line 36
    [2.112]
    [2.112]
    -- do nothing
    elseif key == 'lshift' or key == 'rshift' then
  • replacement in main.lua at line 40
    [2.207][2.207:249]()
    lines[#lines] = lines[#lines]..' aaa'
    [2.207]
    [3.555]
    if key == 'r' then
    lines[#lines+1] = eval(lines[#lines])[1]
    lines[#lines+1] = ''
    end
  • edit in main.lua at line 49
    [3.612]
    [3.612]
    function eval(buf)
    local f = load('return '..buf, 'REPL')
    if f then
    return call_gather(f)
    end
    local f, err = load(buf, 'REPL')
    if f then
    return call_gather(f)
    else
    return {err}
    end
    end
    -- based on https://github.com/hoelzro/lua-repl
    function call_gather(f)
    local success, results = gather_results(xpcall(f, function(...) return debug.traceback() end))
    return results
    end
    function gather_results(success, ...)
    local n = select('#', ...)
    return success, { n = n, ... }
    end