An open API service indexing awesome lists of open source software.

https://github.com/squeek502/lua-windcon

Lua module for interacting with the console on Windows
https://github.com/squeek502/lua-windcon

Last synced: 2 months ago
JSON representation

Lua module for interacting with the console on Windows

Awesome Lists containing this project

README

        

# lua-windcon

[![Build status](https://ci.appveyor.com/api/projects/status/7ppcr73lx2hboy0a?svg=true)](https://ci.appveyor.com/project/squeek502/lua-windcon)

`windcon` is a [Lua](https://www.lua.org/) module for interacting with the console on Windows.

```lua
local windcon = require('windcon')

-- Clear the screen
windcon.clear()

-- Get the console size
local w, h = windcon.size()

-- Move the cursor to the center
windcon.movecursor(w / 2, h / 2)

-- Hide the cursor
windcon.showcursor(false)
```

## Installation
With [Luarocks](https://luarocks.org/modules/squeek502/windcon):

```
luarocks install windcon
```

## API Reference

### `windcon.showcursor([state = true])`
Sets the visibility of the cursor to `state`. On success, returns `true`.

### `windcon.movecursor(x, y)`
Moves the cursor to the given coordinates. On success, returns `true`; otherwise, returns `nil, errmsg`.

### `windcon.clear()`
Clears the screen. On success, returns `true`; otherwise, returns `nil, errmsg`.

### `windcon.size()`
Returns the width and height of the console.