testscreen.lua
local sys = require("system")
local t = require("terminal")
local function testscreen()
local r, c = sys.termsize()
local row = ("1234567890"):rep(math.floor(c/10) + 1):sub(1, c)
t.textpush{
fg = "red",
brightness = "dim",
}
for i = 1, r do
t.cursor_set(i, 1)
t.write(row)
end
t.textpop()
end
t.initialize{
displaybackup = true,
filehandle = io.stdout,
}
t.clear()
testscreen()
local edge = 2
local r,c = sys.termsize()
t.cursor_set(edge+1, edge+1)
t.box(r - 2*edge, c - 2*edge, t.box_fmt.double, true, "test screen")
t.cursor_move(1, 1)
t.textset{
fg = "red",
bg = "blue",
brightness = 3,
}
t.write("Hello World! press any key, or wait 5 seconds...")
t.flush()
t.readansi(5)
t.shutdown()
print("done!")