Added better text formatting.

This commit is contained in:
Andrew Lalis 2022-12-29 11:12:12 +01:00
parent c6e5533e30
commit 672ed192e3
1 changed files with 8 additions and 6 deletions

View File

@ -54,27 +54,29 @@ end
local function clearMessageLine() local function clearMessageLine()
local _, h = term.getSize() local _, h = term.getSize()
term.setCursorPos(1, h - 1)
term.setBackgroundColor(colors.gray) term.setBackgroundColor(colors.gray)
term.clearLine() for i = 0, 3 do
term.setCursorPos(1, h - i)
term.clearLine()
end
end end
local function showError(msg) local function showError(msg)
clearMessageLine() clearMessageLine()
local _, h = term.getSize() local _, h = term.getSize()
term.setCursorPos(2, h - 1) term.setCursorPos(1, h - 2)
term.setBackgroundColor(colors.gray) term.setBackgroundColor(colors.gray)
term.setTextColor(colors.red) term.setTextColor(colors.red)
term.write(msg) write(msg)
end end
local function showMessage(msg) local function showMessage(msg)
clearMessageLine() clearMessageLine()
local _, h = term.getSize() local _, h = term.getSize()
term.setCursorPos(2, h - 1) term.setCursorPos(1, h - 2)
term.setBackgroundColor(colors.gray) term.setBackgroundColor(colors.gray)
term.setTextColor(colors.lightBlue) term.setTextColor(colors.lightBlue)
term.write(msg) write(msg)
end end
local function getPeripheralOrWait(name) local function getPeripheralOrWait(name)