window:getch()
But how do we get curses.getch() to work? I don't see it implemented in lcurses.
This commit is contained in:
parent
14b16003b1
commit
44258f7657
|
@ -65,11 +65,10 @@ end
|
|||
local function main()
|
||||
local screen = curses.stdscr()
|
||||
|
||||
render(screen)
|
||||
--? while true do
|
||||
--? render(screen)
|
||||
--? update(screen)
|
||||
--? end
|
||||
while true do
|
||||
render(screen)
|
||||
update(screen)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -135,6 +135,18 @@ static int Wclear (lua_State *L) {
|
|||
}
|
||||
|
||||
|
||||
static int Wgetch (lua_State *L) {
|
||||
WINDOW *w = checkwin(L, 1);
|
||||
int c = wgetch(w);
|
||||
|
||||
if (c == ERR)
|
||||
return 0;
|
||||
|
||||
lua_pushinteger(L, c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int Wgetyx (lua_State *L) {
|
||||
WINDOW *w = checkwin(L, 1);
|
||||
int y, x;
|
||||
|
@ -183,6 +195,7 @@ static const luaL_Reg curses_window_methods[] =
|
|||
{"attroff", Wattroff},
|
||||
{"attron", Wattron},
|
||||
{"clear", Wclear},
|
||||
{"getch", Wgetch},
|
||||
{"getmaxyx", Wgetmaxyx},
|
||||
{"getyx", Wgetyx},
|
||||
{"mvaddch", Wmvaddch},
|
||||
|
|
Loading…
Reference in New Issue