Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _M = {
- ["version"] = 1.0
- }
- ---@param text string
- ---@param term_y number
- ---@param text_colour string
- ---@param back_colour string
- ---@return nil
- function Write_In_Centre_Colour(text, term_y, text_colour, back_colour)
- ---@type number, number
- local term_x, term_y = term.getSize()
- ---@type number
- local text_length = string.len(text)
- ---@type number
- local write_x = (term_x / 2) - (text_length / 2)
- term.setCursorPos(write_x, term_y)
- ---@type string
- local last_text_colour = term.getTextColour()
- ---@type string
- local last_back_colour = term.getBackgroundColour()
- term.setTextColour(text_colour)
- term.setBackgroundColour(back_colour)
- write(text)
- term.setTextColour(last_text_colour)
- term.setBackgroundColour(last_back_colour)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement