Advertisement
SirBaconBitz

Recipe Creator

Jun 30th, 2014
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. handle = fs.open("recipes", "r")
  2. output = handle.readAll()
  3. if output == "test" then
  4.   dest = {}
  5. else
  6.   dest = textutils.unserialize(output)
  7. end
  8. handle.close()
  9. currtable = {}
  10. term.clear()
  11. term.setCursorPos(1,1)
  12. term.write("Name of output: ")
  13. crafted = read()
  14. term.setCursorPos(1,2)
  15. term.write("Type of output: ")
  16. craftedtype = read()
  17. table.insert(currtable, { name = crafted , type = craftedtype})
  18. for i = 1,9 do
  19.   term.clear()
  20.   term.setCursorPos(1,1)
  21.   term.write("Name of component in slot "..i..":")
  22.   component = read()
  23.   term.clear()
  24.   term.setCursorPos(1,1)
  25.   term.write("Type of component in slot"..i..":")
  26.   comptype = read()
  27.   table.insert(currtable, {name = component, type = comptype})
  28. end
  29. table.insert(dest, currtable)
  30. handle = fs.open("recipes", "w")
  31. handle.write(textutils.serialize(dest))
  32. handle.close()
  33. shell.run("startup")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement