Code Monkey home page Code Monkey logo

lua-nocurses's Introduction

lua-nocurses

Install

Simple terminal manipulation capability for the Lua scripting language by the use of VT100 ESC sequences.

This package is based on nocurses by Rahul M. Juliato. It is aimed to simple applications where ncurses is simple "too much".

Supported platforms: Linux, MacOS and Cygwin.

Examples

  • example01.lua

    Simple Hello World program.

  • example02.lua

    Hello World program, that reacts on terminal size changes while waiting for keyboard input.

  • example03.lua

    Reacts on messages from a background thread while also evaluating keyboard input.

    Uses llthreads2 for thread creation and connects the nocurses lua module as notifier to a mtmsg buffer object for receiving messages from the background thread. (This is done by implementing the Notify C API, see: src/notify_capi.h)

Documentation

See also original documentation at https://github.com/LionyxML/nocurses.

Module Functions

  • nocurses.awake()

    May be called from any thread to interrupt nocurses.getch() on the main thread. The main thread is the first thread that loads the nocurses module.

  • nocurses.getch(timeout)

    Gets a character without waiting for enter.

    • timeout - optional float, timeout in seconds.

    If timeout is given and not nil, this function returns nil if no input is available after timeout seconds.

    If timeout is not given or nil this function waits without timeout until input becomes available.

    This function returns nil if:

    • nocurses.awake() is called from any other thread.

    • the nocurses module is notified from native C code running in any other thread. This is done by implementing the Notify C API, see: src/notify_capi.h.

    • the terminal size changes.

  • nocurses.gotoxy(x, y)

    Sets the cursor do the position x, y. Where x is the row number and y the line number.

Color Names

Valid color names are:

  • BLACK
  • RED
  • GREEN
  • YELLOW
  • BLUE
  • MAGENTA
  • CYAN
  • WHITE

Shape Names

Valid shape names are:

  • BLOCK_BLINK
  • BLOCK
  • UNDERLINE_BLINK
  • UNDERLINE
  • BAR_BLINK
  • BAR

lua-nocurses's People

Contributors

osch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.