Advertisement
MrTurtle

API Loader/Installer

May 26th, 2014
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. --API loader only. Adapted from CraftOS pastebin code. Can be easily adapted to load your API
  2. --just change the raw.php?i= code and "t" to your pastebin code and api filename.
  3. print("Loading Robust Turtle API...")
  4. local load = os.loadAPI("t")
  5. if load then
  6.   print("Robust Turtle API loaded.")
  7. else
  8.  print("Robust Turtle API not found in the root directory with filename t")
  9.  print("Attempting to download as t from pastebin...")
  10.  os.sleep(2)
  11.  local response = http.get("http://pastebin.com/raw.php?i= e0UksEtT")
  12.  if response then
  13.     print("Great Success.")    
  14.     local data = response.readAll()
  15.     response.close()
  16.     local file = fs.open("t", "w")
  17.     file.write(data)
  18.     file.close()
  19.     print("Downloaded as t")
  20.     load = os.loadAPI("t")
  21.     if load then
  22.      print("Robust Turtle API installed & loaded.")
  23.     end
  24.  else
  25.     print( "Download failed. Please install manually from http://pastebin.com/u/MrTurtle." )
  26.     return
  27.  end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement