Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- v1
- -- load Config
- local config = require("config")
- local chat = peripheral.wrap(config.ai.chat)
- local owner = config.general.owner
- local UTILS = {}
- -- Gerador de Alertas (toast)
- function UTILS.msgAlerta(msg, source, title, user)
- title = title or "Zen"
- user = user or owner
- source = source or " "
- local ok, err = chat.sendToastToPlayer(msg, title, user, source, "[]", "&c")
- if not ok then
- print("Erro ao enviar toast: " .. tostring(err))
- end
- end
- -- funçoes de texto em terminal
- --Limpar tela
- function UTILS.clearScreen()
- term.clear()
- term.setCursorPos(1,1)
- end
- -- Centraliza em X e Y (O meio do Meio hihihihihi)
- function UTILS.centerXY(txt)
- UTILS.clearScreen()
- local width, height = term.getSize()
- local x = math.floor((width - #txt) / 2) + 1
- local y = math.floor(height / 2)
- term.setCursorPos(x, y)
- print(txt)
- end
- -- Centraliza na mesma linha
- function UTILS.center(txt, width)
- width = width or term.getSize()
- local padding = math.floor((width - #txt) / 2)
- if padding < 0 then padding = 0 end
- print(string.rep(" ", padding) .. txt)
- end
- return UTILS
Advertisement
Add Comment
Please, Sign In to add comment