diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-03-19 12:33:30 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-03-19 12:33:30 -0500 |
commit | b20dbd285f508047a13b2ebd928eeb7fc49d7d31 (patch) | |
tree | 6da32910a6f92e23fbd0d178639f5a5ed17ffbf8 | |
parent | 7f09f5124acb3cc6e13763a20e2469749b530fe8 (diff) | |
download | luancurses-b20dbd285f508047a13b2ebd928eeb7fc49d7d31.tar.gz luancurses-b20dbd285f508047a13b2ebd928eeb7fc49d7d31.zip |
implement ungetch
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | src/curses.c | 13 |
2 files changed, 14 insertions, 1 deletions
@@ -1,7 +1,7 @@ - chtype arrays (curs_addchstr, curs_inchstr) - the point of these routines is that they are more efficient, since you pass in an array of chtypes rather than an array of chars. how can i expose this functionality? - reading from the screen (curs_instr, curs_inch) -- reading input (ungetch (curs_getch), curs_getstr +- reading input (curs_getstr) - attribute support (curs_attr) - finish up curs_color (color_content, pair_content) - scrolling support (curs_scroll, setscrreg (curs_outopts)) diff --git a/src/curses.c b/src/curses.c index 6eb2066..07814bc 100644 --- a/src/curses.c +++ b/src/curses.c @@ -443,6 +443,18 @@ static int l_getch(lua_State* L) return 1; } +static int l_ungetch(lua_State* L) +{ + const char* ch_str; + int ch; + + ch_str = luaL_checklstring(L, 1, NULL); + ch = get_key_enum(ch_str); + + lua_pushboolean(L, ungetch(ch) == OK); + return 1; +} + static int l_move(lua_State* L) { pos p; @@ -674,6 +686,7 @@ const luaL_Reg reg[] = { { "init_color", l_init_color }, { "init_pair", l_init_pair }, { "getch", l_getch }, + { "ungetch", l_ungetch }, { "move", l_move }, { "addch", l_addch }, { "echochar", l_echochar }, |