diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-20 16:16:00 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-20 16:33:41 -0800 |
commit | b618bfc7cf7eb5fa498a051a17832c2cda4cca9c (patch) | |
tree | 0e5179289101da53572f9bce6c9f543d054d010a /src/lcurses/curses.lua | |
parent | 8a3e81b4b0d8365baa40ff1326ed4d13b34506dc (diff) | |
download | teliva-b618bfc7cf7eb5fa498a051a17832c2cda4cca9c.tar.gz |
port changes from minimal to maximal version
From lcurseslib.c to lcurses/ directory.
Diffstat (limited to 'src/lcurses/curses.lua')
-rw-r--r-- | src/lcurses/curses.lua | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/src/lcurses/curses.lua b/src/lcurses/curses.lua index bba9d12..216fb42 100644 --- a/src/lcurses/curses.lua +++ b/src/lcurses/curses.lua @@ -1,53 +1,20 @@ --- Lua bindings for curses local M = curses --- These Lua functions detect number of args, like Unified Funcs in Perl Curses --- see http://pjb.com.au/comp/lua/lcurses.html --- see http://search.cpan.org/perldoc?Curses - -function M.addch (...) - if #{...} == 3 then - return curses.stdscr():mvaddch(...) - else - return curses.stdscr():addch(...) - end -end - -function M.addstr(...) -- detect number of args, like Unified Funcs in Perl Curses - if #{...} == 3 then - return curses.stdscr():mvaddstr(...) - else - return curses.stdscr():addstr(...) - end -end +function M.addch (c) return curses.stdscr():addch(c) end +function M.mvaddch (y, x, c) return curses.stdscr():mvaddch(y, x, c) end +function M.addstr (s) return curses.stdscr():addstr(s) end +function M.mvaddstr (y, x, s) return curses.stdscr():mvaddstr(y, x, s) end function M.attrset (a) return curses.stdscr():attrset(a) end function M.clear () return curses.stdscr():clear() end function M.clrtobot () return curses.stdscr():clrtobot() end function M.clrtoeol () return curses.stdscr():clrtoeol() end -function M.getch (...) - local c - if #{...} == 2 then - c = curses.stdscr():mvgetch(...) - else - c = curses.stdscr():getch() - end - if c < 256 then - return string.char(c) - end - -- could kludge-test for utf8, e.g. c3 a9 20 c3 aa 20 c3 ab 20 e2 82 ac 0a - return c -end - -function M.getstr (...) - if #{...} > 1 then - return curses.stdscr():mvgetstr(...) - else - return curses.stdscr():getstr(...) - end -end -M.getnstr = M.getstr +function M.getch () return curses.stdscr():getch() end +function M.mvgetch (y, x) return curses.stdscr():getch(y, x) end +function M.getstr (s) return curses.stdscr():getstr(s) end +function M.mvgetstr (y, x, s) return curses.stdscr():mvgetstr(y, x, s) end function M.getyx () return curses.stdscr():getyx() end function M.keypad (b) return curses.stdscr():keypad(b) end |