Luart
Comprehensive Windows framework to develop in Lua
modules > console > locate

console.locate ( column, line )

Position the console cursor to the specified location on the console. The position 1,1 represent the upper left corner in the console.

Parameters

column

A number representing the horizontal position of the cursor from 1 to console.width

line

A number representing the vertical position of the cursor from 1 to console.height

Return value

The function returns no value.

Example


local console = require "console"

local colors = { "black", "blue", "green", "cyan", "red", "purple", "yellow",
"white", "gray", "lightblue", "lightgreen", "lightcyan", "lightred", 
"lightpurple", "lightyellow", "brightwhite" }

-- random starfield in luaRT

math.randomseed(sys.clock())
for i=1,console.height*console.width/3 do
	console.locate(math.random(console.width), math.random(console.height))
	console.writecolor(colors[math.random(#colors)], "+")
end
console.readchar()
console.clear()