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-10 22:15:13 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-10 22:15:13 -0800
commit9a49b92703e565957d360d6dacc0753019dbf28d (patch)
treedd342dcc04bfc5fa66772270dca5755ac4203c6e /src/lua.c
parentefbb57d33976db19167c0d69ff87daabf61785af (diff)
downloadteliva-9a49b92703e565957d360d6dacc0753019dbf28d.tar.gz
.
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/lua.c b/src/lua.c
index 94a9509..2600f44 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -75,29 +75,6 @@ static int report (lua_State *L, int status) {
 }
 
 
-/* death and rebirth */
-char *Script_name = NULL;
-char **Argv = NULL;
-extern void edit(char *filename, const char *status);
-void switch_to_editor(const char *message) {
-  endwin();
-  edit(Script_name, message);
-  execv(Argv[0], Argv);
-  /* never returns */
-}
-
-
-const char *Previous_error = NULL;
-static int show_error_in_editor (lua_State *L, int status) {
-  if (status && !lua_isnil(L, -1)) {
-    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;
-}
-
-
 static int traceback (lua_State *L) {
   if (!lua_isstring(L, 1))  /* 'message' not a string? */
     return 1;  /* keep it intact */
@@ -329,6 +306,29 @@ static int handle_image (lua_State *L, char **argv, int n) {
 }
 
 
+/* death and rebirth */
+char *Script_name = NULL;
+char **Argv = NULL;
+extern void edit(char *filename, const char *status);
+void switch_to_editor(const char *message) {
+  endwin();
+  edit(Script_name, message);
+  execv(Argv[0], Argv);
+  /* never returns */
+}
+
+
+const char *Previous_error = NULL;
+static int show_error_in_editor (lua_State *L, int status) {
+  if (status && !lua_isnil(L, -1)) {
+    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;
+}
+
+
 static int handle_script (lua_State *L, char **argv, int n) {
   if (has_extension(argv[n], "tlv"))
     return handle_image(L, argv, n);