summaryrefslogtreecommitdiffhomepage
path: root/contrib/luacurses/src/test/hello.lua
blob: 6a1d28a21621b5dfafd6a75bd74852933f39a9d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

require("curses");

function show_message(message)
  local width = string.len(message) + 6;
  win = curses.newwin(5, width, (curses.LINES() - 5) / 2, (curses.COLS() - width) / 2);
  win:box('|', '-');
  win:mvaddstr(2, 3, message);
  win:getch();
  win:delwin();
end

curses.initscr();
curses.cbreak();
curses.mvaddstr((curses.LINES() - 5) / 2, (curses.COLS() - 10) / 2, "Hit any key");
curses.getch();
show_message("Hello, World!")

curses.endwin();