Advertisement
callmebackdraft

Untitled

Sep 23rd, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. a = peripheral.wrap("right")
  2.  
  3. function statsToTable()
  4.  seed = a.getSeedInAnalyzer()
  5.  a.analyze()
  6.  growth, gain, strength = a.getSpecimenStats()
  7.  seedTable = {seed, growth, gain, strength}
  8.  for key, value in pairs(seedTable) do
  9.    print("key: "..key.." is "..value)
  10.  end
  11. end
  12.  
  13. function save(table,name)
  14. local file = fs.open(name,"w")
  15. file.write(textutils.serialize(table))
  16. file.close()
  17. end
  18.  
  19. function load(name)
  20. local file = fs.open(name,"r")
  21. local data = file.readAll()
  22. file.close()
  23. print(data)
  24. checkTable = textutils.unserialize(data)
  25.  for key, value in pairs(checkTable) do
  26.    print("key: "..key.." is "..value)
  27.  end
  28. end
  29.  
  30. print()
  31. --while true dofile(
  32.  statsToTable()
  33.  save(seedTable, seedTable[1])
  34.  if fs.exists(seedTable[1]) then
  35.  print("jeej")
  36.  print(data)
  37.  end
  38.  load(seedTable[1])
  39. --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement