Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Title: me_exportbus test program
- --
- -- File Name: test
- --
- --Description: Reads all items in database and
- -- attempts to export 1 instance of
- -- each item to a chest through the
- -- export bus
- --
- -- Notes: I use sides.bottom here, this will
- -- be different depending on the placement
- -- of your me_exportbus! I will eventually
- -- write a function to set this value
- -- dynamically (or maybe not, I'm lazy)
- --
- -- Keep in mind the database itemstack info
- -- is manually added at the moment, I will
- -- eventually add a means of using an inventory
- -- controller to manage the database programmatically
- -- (if possible with ME system)
- local component = require('component')
- local sides = require('sides')
- local db = component.database
- local cont = component.me_controller --not actually used
- local exBus = component.me_exportbus
- local busSide = sides.bottom --you might need to change this
- --for loop to print all the items in DB
- --should dynamically calculate end of loop
- for i = 1, 5 do
- item = db.get(i)
- print("--ITEM " .. i .. " START--")
- for k,v in pairs(item) do
- print(k,v)
- end
- print("--ITEM " .. i .. " END--")
- end
- print("\n\n")
- --for loop sets the export config to a different item
- --each loop, prints the config, then tries to export 1 item.
- --Should also dynamically calculated end of loop, but in actual
- --real use I probably will have a function along the lines of
- --exportItem(itemName) or something similar, which will do all
- --the work required to set the export config and pump out a single
- --instance of that item to the chest (resetting the config after)
- for i = 0, 4 do
- --start run i and set config for next item
- print("--------- Run " .. i .. " Start ---------\n")
- print("Set Config: ",exBus.setExportConfiguration(busSide, 1, db.address, i+1))
- --print the config, comment this block out if you don't care
- config = exBus.getExportConfiguration(busSide, 1)
- print("\n!! Export Bus Config Start !!\n")
- for k,v in pairs(config) do
- print(k,v)
- end
- print("\n!! Export Bus Config End !!\n")
- print("Try Export: ",exBus.exportIntoSlot(busSide,i+1), "\n") -- try export an item
- end
- exBus.setExportConfiguration(0) --clear the config
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement