diff options
Diffstat (limited to 'src/lua.c')
-rw-r--r-- | src/lua.c | 46 |
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); |