Advertisement
Guest User

LTAPI.lua

a guest
May 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. function a()
  2. --shell.run("LTAPI.lua")
  3. daten = ltapi.laden()
  4. end
  5.  
  6. function clear()
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. end
  10.  
  11. function laden()
  12. file = fs.open("daten.dat","r")
  13. if file ~= nil then
  14. datei = file.readAll()
  15. file.close()
  16. --daten = textutils.unserialise(datei)
  17. return textutils.unserialise(datei)
  18. end
  19. end
  20.  
  21. function speichern(daten)
  22. file = fs.open("daten.dat","w")
  23. file.write(textutils.serialise(daten))
  24. file.close()
  25. end
  26.  
  27. function farben()
  28. a()
  29. term.setBackgroundColor(daten.hfarbe)
  30. term.setTextColor(daten.tfarbe)
  31. end
  32.  
  33. function writeCentered(text,y)
  34. x = term.getSize()
  35. x = (x/2)-(#text/2)
  36. term.setCursorPos(x,y)
  37. term.write(text)
  38. end
  39.  
  40. function writeCenteredAS(text,y)
  41. x = term.getSize()
  42. x = (x/2)-(#text/2)
  43. term.setCursorPos(x,y)
  44. ltapi.pas(text)
  45. end
  46.  
  47. function pas(text)
  48. a()
  49. present = false
  50. if peripheral.getType("right") == "speaker" then
  51. present = true
  52. speaker = peripheral.wrap("right")
  53. elseif peripheral.getType("left") == "speaker" then
  54. present = true
  55. speaker = peripheral.wrap("left")
  56. end
  57. if present == true then
  58. speaker.speak(text)
  59. end
  60. print(text)
  61. end
  62.  
  63. function psw(text)
  64. ltapi.pas(text)
  65. os.pullEvent("mouse_click")
  66. end
  67.  
  68. function version()
  69. file = fs.open("version.dat","r")
  70. versionsinfos = textutils.unserialise(file.readAll())
  71. file.close()
  72. return versionsinfos.version
  73. end
  74.  
  75. function pastebincode()
  76. file = fs.open("version.dat","r")
  77. versionsinfos = textutils.unserialise(file.readAll())
  78. file.close()
  79. return versionsinfos.pastebincode
  80. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement