Now we have separate keywords for returning vs drawing something.
D2GCFTTT2RNUBFB243YTA4F2H5ZXFTFHBSKHLZ2CX4JSKRZFTUUQC XX7G2FFJ4QCGQGD4REAW5QFHVYAKCFUPGZCK7L6DFGS5ISVBYBQQC R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC 6PUNJS5BSLTYMYMN4JFD7YDEGVQLM5PGAT7PQIG5NIAKLTM5T4PQC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC IZZVOCLB7KB4ZNQ35OL466MHWOK3XZMOS7ZPFLHUFQ47LJLQQQ3QC 6LJZN727CRPYR34LV75CQF55YZI3E7MGESYZSFSYAE73SNEZE3FAC 6Q6XGOFLRHPFQPVUKYTRWS4BKJ6G65IUWSS7HBQKV5HYZDEYCICAC -- beginnings of a replfunction eval(buf)local f = load('return '..buf, 'REPL')if f thenreturn run(f)endlocal f, err = load(buf, 'REPL')if f thenreturn run(f)elsereturn {err}endend-- you could perform parse and run separately-- usually because there's a side-effect like drawing that you want to control the timing offunction parse_into_exec_payload(buf)local f = load('return '..buf, 'REPL')if f thenexec_payload = freturnendlocal f, err = load(buf, 'REPL')if f thenexec_payload = freturnelsereturn {err}endend-- based on https://github.com/hoelzro/lua-replfunction run(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
function eval(buf)local f = load('return '..buf, 'REPL')if f thenexec_payload = freturn--? return call_gather(f)endlocal f, err = load(buf, 'REPL')if f thenexec_payload = freturn--? return 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