LivioBrunner

myComputerCraftAPI

Aug 22nd, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. function tclear(x,y)
  2.     if x == nil then
  3.         x = 1
  4.     end
  5.     if y == nil then
  6.         y = 1
  7.     end
  8.     term.clear()
  9.     term.setCursorPos(x,y)
  10. end
  11. function rsSend(side, art, seconds)
  12.     if side == nil then
  13.         side = "back"
  14.     end
  15.     if art == nil then
  16.         art = "button"
  17.     end
  18.     if seconds == nil then
  19.         seconds = 0.2
  20.     end
  21.     if art == "lever" then
  22.         istorf = redstone.getInput(side)
  23.         if istorf == true then
  24.             rs.setOutput(side, false)
  25.         else
  26.             rs.setOutput(side, true)
  27.         end
  28.     else
  29.         rs.setOutput(side, true)
  30.         sleep(seconds)
  31.         rs.setOutput(side, false)
  32.         sleep(seconds)
  33.     end
  34. end
  35. function load(name)
  36.     local file = fs.open(name,"r")
  37.     local data = file.readAll()
  38.     file.close()
  39.     return textutils.unserialize(data)
  40. end
  41. function save(table,name)
  42.     local file = fs.open(name,"w")
  43.     file.write(textutils.serialize(table))
  44.     file.close()
  45. end
  46. name = read()
  47. save(name, "name")
  48. read()
  49. print(load("name"))
Advertisement
Add Comment
Please, Sign In to add comment