-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample01.lua
More file actions
40 lines (31 loc) · 755 Bytes
/
example01.lua
File metadata and controls
40 lines (31 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
local nocurses = require("nocurses")
local function printf(...)
io.write(string.format(...))
io.flush()
end
nocurses.clrscr();
local w, h = nocurses.gettermsize()
local message = "Hello World!"
local x = math.floor((w-#message)/2)
local y = math.floor(h/2)
nocurses.gotoxy(x, y)
nocurses.setfontbold(true)
nocurses.setunderline(true)
printf(message)
nocurses.gotoxy(1, h-1)
nocurses.resetcolors()
nocurses.setinvert(true)
nocurses.clrline()
printf("Press q to Quit")
nocurses.resetcolors()
while true do
local c = nocurses.getch() -- may be nil
c = c and string.char(c)
if c == "Q" or c == "q" then
break
end
end
local w, h = nocurses.gettermsize()
nocurses.gotoxy(1, h-2)
nocurses.clrline()
printf("Finished.\n")