jig487

debugging

Mar 25th, 2022 (edited)
1,184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local function txt(x,y,t,c,b)
  2.     if not c then c = colors.white end
  3.     if not b then b = colors.black end
  4.     term.setCursorPos(x,y)
  5.     term.setTextColor(c)
  6.     term.setBackgroundColor(b)
  7.     write(t)
  8.     term.setTextColor(colors.white)
  9.     term.setBackgroundColor(colors.black)
  10. end
  11.  
  12. local function debug(x,y,t,c,b)
  13.     if not c then c = colors.red end
  14.     if not b then b = colors.white end
  15.     txt(x,y,"Debug: "..t,c,b)
  16.     read()
  17. end
  18.  
  19. local function addToFile(name,str)
  20.     local h = fs.open(name, fs.exists(name) and "a" or "w")
  21.     h.write(str)
  22.     h.close()
  23. end
  24.  
  25. local function overWrite(name,str)
  26.     local h = fs.open(name, "w")
  27.     h.write(str)
  28.     h.close()
  29. end
  30.  
  31. return {
  32.     txt = txt,
  33.     debug = debug,
  34.     addToFile = addToFile,
  35.     overWrite = overWrite
  36. }
Add Comment
Please, Sign In to add comment