summaryrefslogtreecommitdiffstats
path: root/src/lua.c
diff options
context:
space:
mode:
authorandmarti1424 <andmarti@gmail.com>2017-03-18 22:36:14 -0300
committerandmarti1424 <andmarti@gmail.com>2017-03-18 22:36:14 -0300
commitd6abbb522123945d7bd129d389264b0a535a4d92 (patch)
tree0f50db6d1836784eab57fe2f320cdb1e8e8e1d63 /src/lua.c
parent202b8c3d72ba6f85a7d25ae8a942a30e7d0f6231 (diff)
Add stderr buffer and changed bail function in lua.c
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/lua.c b/src/lua.c
index 8c88cf4..27d1d18 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -40,13 +40,33 @@ extern WINDOW * input_win;
lua_State *L;
-void bail(lua_State *L, char *msg){
- //sc_debug("FATAL ERROR: %s: %s", msg, lua_tostring(L, -1));
+void bail(lua_State *L, char * msg){
+ /*
volatile char *error=lua_tostring(L,-1);
fprintf(stderr,"%s",error);
-
+ */
+
fprintf(stderr,"FATAL ERROR: %s: %s", msg, lua_tostring(L, -1));
- //exit(1); shall exit here?
+
+ move(0, 0);
+ clrtobot();
+ wrefresh(stdscr);
+
+ set_term(sstderr);
+ move(0, 0);
+ clrtobot();
+ clearok(stdscr, TRUE);
+ mvprintw(10, 0, "*%s*", stderr_buffer);
+ stderr_buffer[0]='\0';
+ fseek(stderr, 0, SEEK_END);
+
+ refresh();
+ getch();
+
+ set_term(sstdout);
+ clearok(stdscr, TRUE);
+ refresh();
+ update(TRUE);
}
static int l_getnum (lua_State *L) {