filloax

random API for CCraft

Nov 6th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. function redPulse(side)
  2.     redstone.setOutput(side,true)
  3.     os.sleep(0.1)
  4.     redstone.setOutput(side,false)
  5. end
  6.  
  7. function saveStatus(x,filename)
  8.     local success = false;
  9.     if filename == nil then filename = "status.txt"; end
  10.     if type(x) == "string" then
  11.         local fh = fs.open(filename,"w")
  12.         fh.write(x)
  13.         fh.close()
  14.         success = true;
  15.     end
  16.     return success
  17. end
  18.  
  19. function readStatus(filename)
  20.     if filename == nil then filename = "status.txt"; end
  21.     local fh = fs.open(filename,"r")
  22.     local output = fh.readAll()
  23.     fh.close()
  24.     return output
  25. end
Advertisement
Add Comment
Please, Sign In to add comment