summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-04-17 01:46:29 +0100
committerubq323 <ubq323@ubq323.website>2023-04-17 01:46:29 +0100
commit211fbe3a7f367e8df1a9d21c70fb867220c5f90d (patch)
treec05e7813ae7882f6a07e3f1319aad06230a1729b
parentcb960abcd79e3a659f1abedc407cb388f32d8ff8 (diff)
quit nicely on eof (ctrl-d)
-rw-r--r--repl.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/repl.lua b/repl.lua
index 8abb822..4076729 100644
--- a/repl.lua
+++ b/repl.lua
@@ -32,6 +32,9 @@ local function read_chunk()
-- if error ends in <eof> try multiline
local function try(text)
+ if text == nil then
+ os.exit()
+ end
if text:sub(1,3) == ",r " then
return function() reload(text:sub(4)) print("reloaded "..text:sub(4)) end
end