lost_RD

doorInstall

Mar 14th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. print "doorInstall v0.1"
  2. tArgs = ...
  3.  
  4. for k,v in pairs(tArgs) do
  5.   print(k, "  |  ", v)
  6. end
  7.  
  8. if tArgs[1] == "update" then
  9.   shell.run("rm", "doorInstall")
  10.   shell.run("pastebin", "get", "7U2dgmLC", "doorInstall")
  11. elseif tArgs[1] == "delete" then
  12.   shell.run("rm", "doorInstall")
  13. else
  14.  
  15. print("direction to sensor: ")
  16. posSensor = read()
  17. print("direction to piston: ")
  18. posPiston = read()
  19.  
  20. shell.run("pastebin", "get", "Ev40Tvgc", "doorOpen")
  21. shell.run("pastebin", "get", "CunRkRRu", "doorClose")
  22. shell.run("pastebin", "get", "nkxdwYhK", "doorSensor_temp")
  23. shell.run("pastebin", "get", "mJgPiC25", "startup")
  24.  
  25. temp = io.open("doorSensor_temp", "r")
  26. file = io.open("doorSensor", "w")
  27.  
  28. for line in io.lines(temp) do
  29.   if line == 1 then
  30.     io.output(file):write("local posSensor = \"" .. posSensor .. "\"\n")
  31.   elseif line == 2 then
  32.     io.output(file):write("local posPiston = \"" .. posPiston .. "\"\n")
  33.   else
  34.     io.output(file):write(line .. "\n")
  35.   end
  36. end
  37.  
  38. file:close()
  39. temp:close()
  40. fs.delete("doorSensor_temp")
  41. fs.delete("doorInstall")
  42.  
  43. end
Advertisement
Add Comment
Please, Sign In to add comment