console.y read/write property

The console.y property gets or sets the current cursor line position.

Example

local console = require "console" -- Create a title for the console function title(msg, linepos) local length = math.floor((console.width-string.len(msg))/2) console.clear("black") console.y = linepos or 1 console.bgcolor = "lightblue" console.writecolor("blue", string.rep(string.char(0xE2, 0x96, 0x80), console.width)) console.writecolor("brightwhite", string.rep(' ', length)..msg) console.write(string.rep(' ', console.width-length-string.len(msg))) console.bgcolor = "blue" console.writecolor("lightblue", string.rep(string.char(0xE2, 0x96, 0x80), console.width)) console.bgcolor = "black" console.writeln("\n\n\n") end -- The title text and the line to start drawing the title title("Hello World !", 1)