Guest User

Untitled

a guest
May 10th, 2018
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. --Required API's
  2. local component = require "component"
  3. local serialization = require "serialization"
  4. local sides = require "sides"
  5.  
  6. --adapter is connected to an ME controller, and export bus.
  7. local me = component.me_controller
  8. --export bus is has a redstone card set so it doesn't auto-export
  9. local bus = component.me_exportbus
  10.  
  11. --adapter has an database upgrade
  12. local db = component.database
  13.  
  14. --Loop over items in the me network
  15. for key,item in ipairs(me.getItemsInNetwork()) do
  16.  
  17.   --print out each item for debugging; serializing to see the entire data table
  18.   print(item.name.." :: "..serialization.serialize(me.getItemsInNetwork(item)))
  19.  
  20.   --Use the item as a filter to find an item in the me network, and store its
  21.   --itemstack data into the database
  22.   me.store(item,db.address,1,1)
  23.  
  24.   --configure the export bus to export that item
  25.   bus.setExportConfiguration(sides.left,1,db.address,1)
  26.  
  27.   --trigger an export
  28.   bus.exportIntoSlot(sides.left,1)
  29.  
  30.   --clear out the database entry. Might not be needed...
  31.   db.clear(1)
  32. end
Advertisement
Add Comment
Please, Sign In to add comment