lua-windcon
December 8, 2020 ยท View on GitHub
windcon is a Lua module for interacting with the console on Windows.
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:
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.