@@ -34,25 +34,204 @@ Supported platforms: Linux, MacOS and Cygwin.
3434 evaluating keyboard input.
3535
3636 Uses [ llthreads2] for thread creation and connects the
37- ` nocurses ` lua module as notifier to a [ mtmsg] buffer object
37+ * nocurses* lua module as notifier to a [ mtmsg] buffer object
3838 for receiving messages from the background thread.
3939 (This is done by implementing the [ Notify C API] ,
4040 see: [ src/notify_capi.h] ( ./src/notify_capi.h ) )
4141
42- [ Notify C API ] : https://github.com/lua-capis/lua-notify-capi
43-
4442<!-- ---------------------------------------------------------------------------------------- -->
4543
4644## Documentation
4745
48- TODO
49-
5046See also original documentation at https://github.com/LionyxML/nocurses .
5147
48+ * [ Module Functions] ( #module-functions )
49+ * [ nocurses.awake()] ( #nocurses_awake )
50+ * [ nocurses.clrline()] ( #nocurses_clrline )
51+ * [ nocurses.clrscr()] ( #nocurses_clrscr )
52+ * [ nocurses.getch()] ( #nocurses_getch )
53+ * [ nocurses.gettermsize()] ( #nocurses_gettermsize )
54+ * [ nocurses.gotoxy()] ( #nocurses_gotoxy )
55+ * [ nocurses.resetcolors()] ( #nocurses_resetcolors )
56+ * [ nocurses.setbgrcolor()] ( #nocurses_setbgrcolor )
57+ * [ nocurses.setblink()] ( #nocurses_setblink )
58+ * [ nocurses.setcurshape()] ( #nocurses_setcurshape )
59+ * [ nocurses.setfontbold()] ( #nocurses_setfontbold )
60+ * [ nocurses.setfontcolor()] ( #nocurses_setfontcolor )
61+ * [ nocurses.setinvert()] ( #nocurses_setinvert )
62+ * [ nocurses.settitle()] ( #nocurses_settitle )
63+ * [ nocurses.setunderline()] ( #nocurses_setunderline )
64+ * [ nocurses.wait()] ( #nocurses_wait )
65+ * [ Color Names] ( #color-names )
66+ * [ Shape Names] ( #shape-names )
67+
68+ <!-- ---------------------------------------------------------------------------------------- -->
69+ ## Module Functions
70+ <!-- ---------------------------------------------------------------------------------------- -->
71+
72+ * <a id =" nocurses_awake " >** ` nocurses.awake()
73+ `** </a >
74+
75+ May be called from any thread to interrupt [ nocurses.getch()] ( #nocurses_getch ) on the main
76+ thread. The main thread is the first thread that loads the * nocurses* module.
77+
78+ <!-- ---------------------------------------------------------------------------------------- -->
79+
80+ * <a id =" nocurses_clrline " >** ` nocurses.clrline()
81+ `** </a >
82+
83+ Clears the row contents.
84+
85+ <!-- ---------------------------------------------------------------------------------------- -->
86+
87+ * <a id =" nocurses_clrscr " >** ` nocurses.clrscr()
88+ `** </a >
89+
90+ Clears the screen.
91+
92+ <!-- ---------------------------------------------------------------------------------------- -->
93+
94+ * <a id =" nocurses_getch " >** ` nocurses.getch(timeout)
95+ `** </a >
96+
97+ Gets a character without waiting for enter.
98+
99+ * * timeout* - optional float, timeout in seconds.
100+
101+ If timeout is given and not * nil* , this function returns * nil* if no input is available after
102+ * timeout* seconds.
103+
104+ If timeout is not given or * nil* this function waits without timeout until input becomes
105+ available.
106+
107+ This function returns * nil* if:
108+
109+ * [ nocurses.awake()] ( #nocurses_awake ) is called from any
110+ other thread.
111+
112+ * the * nocurses* module is notified from native C code running
113+ in any other thread. This is done by implementing the [ Notify C API] ,
114+ see: [ src/notify_capi.h] ( ./src/notify_capi.h ) .
115+
116+ * the terminal size changes.
117+
118+ <!-- ---------------------------------------------------------------------------------------- -->
119+
120+ * <a id =" nocurses_gettermsize " >** ` nocurses.gettermsize()
121+ `** </a >
122+
123+ Gets the columns and rows of the terminal.
124+
125+ <!-- ---------------------------------------------------------------------------------------- -->
126+
127+ * <a id =" nocurses_gotoxy " >** ` nocurses.gotoxy(x, y)
128+ `** </a >
129+
130+ Sets the cursor do the position x, y. Where x is the row number and y the line number.
131+
132+ <!-- ---------------------------------------------------------------------------------------- -->
133+
134+ * <a id =" nocurses_resetcolors " >** ` nocurses.resetcolors()
135+ `** </a >
136+
137+ Reset terminal to default colors.
138+
139+ <!-- ---------------------------------------------------------------------------------------- -->
140+
141+ * <a id =" nocurses_setbgrcolor " >** ` nocurses.setbgrcolor(colorName)
142+ `** </a >
143+
144+ Sets the background color to one of the colors described on the color table below.
145+
146+ <!-- ---------------------------------------------------------------------------------------- -->
147+
148+ * <a id =" nocurses_setblink " >** ` nocurses.setblink(status)
149+ `** </a >
150+
151+ Sets the blink attribute on or off. * status* can be * true* or * false* .
152+
153+ <!-- ---------------------------------------------------------------------------------------- -->
154+
155+ * <a id =" nocurses_setcurshape " >** ` nocurses.setcurshape(shapeName)
156+ `** </a >
157+
158+ Sets the shape of the cursor in the terminal in the shape table below.
159+
160+ <!-- ---------------------------------------------------------------------------------------- -->
161+
162+ * <a id =" nocurses_setfontbold " >** ` nocurses.setfontbold(status)
163+ `** </a >
164+
165+ Sets the bold attribute on or off. * status* can be * true* or * false* .
166+
167+ <!-- ---------------------------------------------------------------------------------------- -->
168+
169+ * <a id =" nocurses_setfontcolor " >** ` nocurses.setfontcolor(colorName)
170+ `** </a >
171+
172+ Sets the text color to one of the colors described on the color table below.
173+
174+ <!-- ---------------------------------------------------------------------------------------- -->
175+
176+ * <a id =" nocurses_setinvert " >** ` nocurses.setinvert(status)
177+ `** </a >
178+
179+ Sets the invert attribute on or off. * status* can be * true* or * false* .
180+
181+ <!-- ---------------------------------------------------------------------------------------- -->
182+
183+ * <a id =" nocurses_settitle " >** ` nocurses.settitle(title)
184+ `** </a >
185+
186+ Sets the title of the terminal.
187+
188+ <!-- ---------------------------------------------------------------------------------------- -->
189+
190+ * <a id =" nocurses_setunderline " >** ` nocurses.setunderline(status)
191+ `** </a >
192+
193+ Sets the underline attribute on or off. * status* can be * true* or * false* .
194+
195+ <!-- ---------------------------------------------------------------------------------------- -->
196+
197+ * <a id =" nocurses_wait " >** ` nocurses.wait()
198+ `** </a >
199+
200+ Waits for the user to hit [ ENTER] .
201+
202+
203+ <!-- ---------------------------------------------------------------------------------------- -->
204+ ## Color Names
205+ <!-- ---------------------------------------------------------------------------------------- -->
206+
207+ Valid color names are:
208+ * BLACK
209+ * RED
210+ * GREEN
211+ * YELLOW
212+ * BLUE
213+ * MAGENTA
214+ * CYAN
215+ * WHITE
216+
217+ <!-- ---------------------------------------------------------------------------------------- -->
218+ ## Shape Names
219+ <!-- ---------------------------------------------------------------------------------------- -->
220+
221+ Valid shape names are:
222+ * BLOCK_BLINK
223+ * BLOCK
224+ * UNDERLINE_BLINK
225+ * UNDERLINE
226+ * BAR_BLINK
227+ * BAR
228+
52229<!-- ---------------------------------------------------------------------------------------- -->
53230
54231[ Lua ] : https://www.lua.org
55232[ llthreads2 ] : https://luarocks.org/modules/moteus/lua-llthreads2
56233[ mtmsg ] : https://github.com/osch/lua-mtmsg
234+ [ Notify C API ] : https://github.com/lua-capis/lua-notify-capi
235+
57236
58237<!-- ---------------------------------------------------------------------------------------- -->
0 commit comments