diff options
| author | 2025-06-16 11:58:13 +0200 | |
|---|---|---|
| committer | 2025-06-16 12:01:04 +0200 | |
| commit | bd4fc32bace9ee9727243ddf59f0066d5aa5e0a4 (patch) | |
| tree | de14b8461356923fce2c2a12d7f9b9f501ea8f9d /repl.c | |
| parent | c2021ab74da2048fc330c8185d98f2c9331c8149 (diff) | |
repl: put last value in _
Diffstat (limited to 'repl.c')
| -rw-r--r-- | repl.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -75,12 +75,15 @@ main(int argc, char **argv) { using_history(); CHECK(pez_pushglobal(cx, "printf")); + CHECK(pez_pushvoid(cx) && pez_setglobal(cx, "_")); while ((src = readline("> "))) { add_history(src); if (!pez_eval_str(cx, "<repl>", src)) { fprintf(stderr, "error: %s\n", pez_geterr(cx)); } else { assert(pez_top(cx) == 2); + CHECK(pez_push(cx, -1)); + CHECK(pez_setglobal(cx, "_")); CHECK(printtop(cx)); printf("\n"); } |