about summary refs log tree commit diff stats
path: root/src/lua.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-06 14:41:11 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-11-06 14:41:11 -0700
commit62ecf178707fd009653061a47bbb42dc1336b5b7 (patch)
treed2476d30e97648f3cc62c21f53cc3edefdcdfe9c /src/lua.c
parent369eaeeaf10912977a9afb37e4148dcb6567e3d5 (diff)
downloadteliva-62ecf178707fd009653061a47bbb42dc1336b5b7.tar.gz
escape hatch to quit with a pending error
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lua.c b/src/lua.c
index 34fcd13..b92204f 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -86,11 +86,12 @@ void switch_to_editor(const char *message) {
 }
 
 
+const char *Previous_error = NULL;
 static int show_error_in_editor (lua_State *L, int status) {
   if (status && !lua_isnil(L, -1)) {
-    const char *msg = lua_tostring(L, -1);
-    if (msg == NULL) msg = "(error object is not a string)";
-    switch_to_editor(msg);
+    Previous_error = lua_tostring(L, -1);
+    if (Previous_error == NULL) Previous_error = "(error object is not a string)";
+    switch_to_editor(Previous_error);
   }
   return status;
 }