diff options
-rw-r--r-- | src/lbaselib.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lbaselib.c b/src/lbaselib.c index 2ab550b..fa597eb 100644 --- a/src/lbaselib.c +++ b/src/lbaselib.c @@ -7,6 +7,7 @@ #include <ctype.h> +#include <ncurses.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -22,15 +23,9 @@ -/* -** If your system does not support `stdout', you can just remove this function. -** If you need, you can define your own `print' function, following this -** model but changing `fputs' to put the strings at a proper place -** (a console window or a log file, for instance). -*/ static int luaB_print (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ - int i; + int i, y, x; lua_getglobal(L, "tostring"); for (i=1; i<=n; i++) { const char *s; @@ -41,11 +36,13 @@ static int luaB_print (lua_State *L) { if (s == NULL) return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("print")); - if (i>1) fputs("\t", stdout); - fputs(s, stdout); + if (i>1) addstr("\t"); + addstr(s); lua_pop(L, 1); /* pop result */ } - fputs("\n", stdout); + getyx(stdscr, y, x); + mvprintw(y+1, x=0, ""); + refresh(); return 0; } |