{"id":20704325,"url":"https://github.com/osch/lua-nocurses","last_synced_at":"2026-02-18T10:17:42.690Z","repository":{"id":66985042,"uuid":"428788091","full_name":"osch/lua-nocurses","owner":"osch","description":"A terminal screen manipulation library","archived":false,"fork":false,"pushed_at":"2023-11-10T01:10:39.000Z","size":49,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T01:31:59.704Z","etag":null,"topics":["curses","lua","lua-binding","lua-library","tui"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-16T19:30:26.000Z","updated_at":"2025-04-04T02:46:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"341d3a7e-c2c2-4473-b804-3949b92bbddc","html_url":"https://github.com/osch/lua-nocurses","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/osch/lua-nocurses","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-nocurses","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-nocurses/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-nocurses/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-nocurses/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osch","download_url":"https://codeload.github.com/osch/lua-nocurses/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-nocurses/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29575592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curses","lua","lua-binding","lua-library","tui"],"created_at":"2024-11-17T01:11:57.367Z","updated_at":"2026-02-18T10:17:39.323Z","avatar_url":"https://github.com/osch.png","language":"C","readme":"# lua-nocurses\n\n[![Install](https://img.shields.io/badge/Install-LuaRocks-brightgreen.svg)](https://luarocks.org/modules/osch/nocurses)\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\nSimple terminal manipulation capability for the [Lua] scripting language\nby the use of VT100 ESC sequences. \n\nThis package is based on [*nocurses* by Rahul M. Juliato](https://github.com/LionyxML/nocurses).\nIt is aimed to simple applications where ncurses is simple \"too much\".    \n\nSupported platforms: Linux, MacOS and Cygwin.\n\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n## Examples\n\n   * [`example01.lua`](./examples/example01.lua)\n\n     Simple *Hello World* program.\n\n   \n   * [`example02.lua`](./examples/example02.lua)\n\n     *Hello World* program, that reacts on terminal size changes while\n     waiting for keyboard input.\n\n   \n   * [`example03.lua`](./examples/example03.lua)\n   \n     Reacts on messages from a background thread while also\n     evaluating keyboard input. \n     \n     Uses [llthreads2] for thread creation and connects the \n     *nocurses* lua module as notifier to a [mtmsg] buffer object \n     for receiving messages from the background thread. \n     (This is done by implementing the [Notify C API], \n      see: [src/notify_capi.h](./src/notify_capi.h))\n\n   * [`example04.lua`](./examples/example04.lua)\n   \n     Demonstrates how to read keystrokes with multibyte sequences\n     (arrow keys).\n   \n   * [`example05.lua`](./examples/example05.lua)\n   \n     Demonstrates how to read keystrokes with multibyte sequences\n     (arrow keys) using the convenience method [nocurses.getkey()](#nocurses_getkey).\n   \n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n## Documentation\n\nSee also original documentation at https://github.com/LionyxML/nocurses.\n\n   * [Module Functions](#module-functions)\n        * [nocurses.awake()](#nocurses_awake)\n        * [nocurses.clrline()](#nocurses_clrline)\n        * [nocurses.clrscr()](#nocurses_clrscr)\n        * [nocurses.getch()](#nocurses_getch)\n        * [nocurses.peekch()](#nocurses_peekch)\n        * [nocurses.skipch()](#nocurses_skipch)\n        * [nocurses.getkey()](#nocurses_getkey)\n        * [nocurses.gettermsize()](#nocurses_gettermsize)\n        * [nocurses.gotoxy()](#nocurses_gotoxy)\n        * [nocurses.resetcolors()](#nocurses_resetcolors)\n        * [nocurses.setbgrcolor()](#nocurses_setbgrcolor)\n        * [nocurses.setblink()](#nocurses_setblink)\n        * [nocurses.setcurshape()](#nocurses_setcurshape)\n        * [nocurses.setfontbold()](#nocurses_setfontbold)\n        * [nocurses.setfontcolor()](#nocurses_setfontcolor)\n        * [nocurses.setinvert()](#nocurses_setinvert)\n        * [nocurses.settitle()](#nocurses_settitle)\n        * [nocurses.setunderline()](#nocurses_setunderline)\n        * [nocurses.wait()](#nocurses_wait)\n        * [nocurses.hidecursor()](#nocurses_hidecursor)\n        * [nocurses.showcursor()](#nocurses_showcursor)\n   * [Color Names](#color-names)\n   * [Shape Names](#shape-names)\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n##   Module Functions\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_awake\"\u003e**`nocurses.awake()\n  `**\u003c/span\u003e\n\n  May be called from any thread to interrupt [nocurses.getch()](#nocurses_getch) on the main\n  thread. The main thread is the first thread that loads the *nocurses* module.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_clrline\"\u003e**`nocurses.clrline()\n  `**\u003c/span\u003e\n\n  Clears the row contents.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_clrscr\"\u003e**`nocurses.clrscr()\n  `**\u003c/span\u003e\n\n  Clears the screen.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_getch\"\u003e**`nocurses.getch([timeout])\n  `**\u003c/span\u003e\n\n  Gets a character byte without waiting for enter.\n  \n  * *timeout* - optional float, timeout in seconds.\n  \n  If timeout is given and not *nil*, this function returns *nil* if no input is available after\n  *timeout* seconds.\n  \n  If timeout is not given or *nil* this function waits without timeout until input becomes\n  available.\n  \n  This function returns *nil* if:\n  \n     * [nocurses.awake()](#nocurses_awake) is called from any\n       other thread.\n  \n     * the *nocurses* module is notified from native C code running\n       in any other thread. This is done by implementing the [Notify C API], \n       see: [src/notify_capi.h](./src/notify_capi.h).\n       \n     * the terminal size changes.\n  \n  Otherwise this function returns the obtained character byte as integer value.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n* \u003cspan id=\"nocurses_peekch\"\u003e**`nocurses.peekch([cnt])\n  `**\u003c/span\u003e\n  \n  Obtains next character byte from the input queue without consuming the character, i.e.\n  a subsequent call to [nocurses.getch()](#nocurses_getch) will deliver this byte again.\n  \n  * *cnt* - optional integer, number of the byte in the input queue to obtain, first byte\n            has number 1. If not given, the default value is 1, i.e. the first byte in the\n            input queue is obtained.\n\n  This function does not wait and will return *nil* if the specified input byte is not \n  available. \n  \n  The input character byte is returned as integer value.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n* \u003cspan id=\"nocurses_skipch\"\u003e**`nocurses.skipch([cnt])\n  `**\u003c/span\u003e\n\n  Discards bytes in the input queue.\n\n  * *cnt* - optional integer, number of bytes in the input queue to discard. If not given, \n            the default value is 1, i.e. the first byte in the input queue is skipped, \n            if available..\n\n  This function does not wait and will skip only input bytes in the queue that are immediately \n  available.\n  \n  This funtion returns the number of bytes skipped in the input queue.\n  \n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n* \u003cspan id=\"nocurses_getkey\"\u003e**`nocurses.getkey([timeout])\n  `**\u003c/span\u003e\n\n  Returns the name of the pressed key as string.\n  \n  This function is implemented in Lua (see [`getkey.lua`](./src/nocurses/getkey.lua)) \n  using the low level functions [getch()](#nocurses_getch), \n  [peekch()](#nocurses_peekch) and [skipch()](#nocurses_skipch) and \n  heuristically determines the pressed key for the current input byte sequence.\n\n  * *timeout* - optional float, timeout in seconds.\n  \n  The timout handling is the same as in the function [nocurses.getch()](#nocurses_getch).\n\n  If a pressed key could be determined, this functions returns the key name as string\n  and the consumed raw input bytes as string.  \n\n  If the pressed key could not be determined from the input byte sequence, this functions \n  returns the boolean value *false*  and the consumed raw input bytes as string.\n  \n  See also: [`example05.lua`](./examples/example05.lua)\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_gettermsize\"\u003e**`nocurses.gettermsize()\n  `**\u003c/span\u003e\n\n  Gets the columns and rows of the terminal.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_gotoxy\"\u003e**`nocurses.gotoxy(x, y)\n  `**\u003c/span\u003e\n\n  Sets the cursor do the position x, y. Where x is the row number and y the line number.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_resetcolors\"\u003e**`nocurses.resetcolors()\n  `**\u003c/span\u003e\n\n  Reset terminal to default colors.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_setbgrcolor\"\u003e**`nocurses.setbgrcolor(colorName)\n  `**\u003c/span\u003e\n\n  Sets the background color to one of the colors described on the color table below.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_setblink\"\u003e**`nocurses.setblink(status)\n  `**\u003c/span\u003e\n\n  Sets the blink attribute on or off. *status* can be *true* or *false*.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_setcurshape\"\u003e**`nocurses.setcurshape(shapeName)\n  `**\u003c/span\u003e\n\n  Sets the shape of the cursor in the terminal in the shape table below.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_setfontbold\"\u003e**`nocurses.setfontbold(status)\n  `**\u003c/span\u003e\n\n  Sets the bold attribute on or off. *status* can be *true* or *false*.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_setfontcolor\"\u003e**`nocurses.setfontcolor(colorName)\n  `**\u003c/span\u003e\n\n  Sets the text color to one of the colors described on the color table below.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_setinvert\"\u003e**`nocurses.setinvert(status)\n  `**\u003c/span\u003e\n\n  Sets the invert attribute on or off. *status* can be *true* or *false*.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_settitle\"\u003e**`nocurses.settitle(title)\n  `**\u003c/span\u003e\n\n  Sets the title of the terminal.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_setunderline\"\u003e**`nocurses.setunderline(status)\n  `**\u003c/span\u003e\n\n  Sets the underline attribute on or off. *status* can be *true* or *false*.\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_wait\"\u003e**`nocurses.wait()\n  `**\u003c/span\u003e\n\n  Waits for the user to hit [ENTER].\n\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_hidecursor\"\u003e**`nocurses.hidecursor()\n  `**\u003c/span\u003e\n\n  Hides the cursor. If the program exits, a hidden cursor is automatically made visible again.\n\n  See also: [`example05.lua`](./examples/example05.lua)\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n* \u003cspan id=\"nocurses_showcursor\"\u003e**`nocurses.showcursor()\n  `**\u003c/span\u003e\n\n  Makes the cursor visible. To be called after [nocurses.hidecursor()](#nocurses_hidecursor).\n\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n##   Color Names\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\nValid color names are:\n  * BLACK\n  * RED\n  * GREEN\n  * YELLOW\n  * BLUE\n  * MAGENTA\n  * CYAN\n  * WHITE  \n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n##   Shape Names\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\nValid shape names are:\n  * BLOCK_BLINK\n  * BLOCK\n  * UNDERLINE_BLINK\n  * UNDERLINE\n  * BAR_BLINK\n  * BAR\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n\n[Lua]:           https://www.lua.org\n[llthreads2]:    https://luarocks.org/modules/moteus/lua-llthreads2\n[mtmsg]:         https://github.com/osch/lua-mtmsg\n[Notify C API]: https://github.com/lua-capis/lua-notify-capi\n\n\n\u003c!-- ---------------------------------------------------------------------------------------- --\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosch%2Flua-nocurses","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosch%2Flua-nocurses","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosch%2Flua-nocurses/lists"}