Advertisement
k2green

Crafting setup

Aug 4th, 2024
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | Software | 0 0
  1. local data = {}
  2.  
  3. print("Enter the target inventory:")
  4. data.primaryInventory = read()
  5.  
  6. print("\nEnter the secondary inventory direction:")
  7. data.secondaryInventory = read()
  8.  
  9. print("\nEnter the fluid used for crafting:")
  10. data.craftingFluid = read()
  11.  
  12. print("\nEnter the direction to turn:")
  13. data.turnDirection = read()
  14.  
  15. print("\nEnter the delay:")
  16. data.delay = tonumber(read())
  17.  
  18. print("\nEnter the resulting item:")
  19. data.result = { name = read() }
  20.  
  21. print("\nEnter the resulting count:")
  22. data.result.count = tonumber(read())
  23. data.ingredients = {}
  24.  
  25. for i=1, 15 do
  26.     print("\nEnter an ingredient name (use !q to stop):")
  27.     local name = read()
  28.    
  29.     if name == "!q" then
  30.         break
  31.     end
  32.    
  33.     print("\nEnter an ingredient count:")
  34.     local count = tonumber(read())
  35.    
  36.     table.insert(data.ingredients, { name = name, count = count })
  37. end
  38.  
  39. print("\nEnter the output file name:")
  40. local fileName = read()
  41. local file = fs.open(fileName, "w")
  42. file.write(textutils.serializeJSON(data))
  43. file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement