Advertisement
Redxone

Computercraft - Virtual Hard Disk Loader

Jul 20th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. -- ]] now to load hdd [[ --
  2. local _system = {}
  3.  
  4. if(fs.isDir("vhd"))then
  5.   fs.delete("vhd")
  6. end
  7. local
  8. -- ]] make all files in _system [[ --
  9. function loadFiles()
  10. fs.makeDir("vhd")
  11.   for k, v in pairs(_system) do
  12.     f = fs.open("vhd/"..k,"w")
  13.     f.write(v.content)
  14.     f.close()
  15.     print(k)
  16.   end
  17.   print("VHD Loaded!")
  18. end
  19.  
  20.  
  21. -- ]] load harddisk [[ --
  22.  
  23. local arg = { ... }
  24.  
  25. if(#arg < 1)then error("Ussage: loadhdd <vhd>") end
  26.  
  27.  
  28. local vhd = arg[1]
  29. f = fs.open(vhd,"r")
  30. _system = textutils.unserialize(f.readAll())
  31. f.close()
  32.  
  33. loadFiles()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement