Last active
August 1, 2017 00:21
-
-
Save dkowis/e47ea42520fe6933fea69f18211dfa2d to your computer and use it in GitHub Desktop.
Learning some OpenComputers API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local component = require("component"); | |
local sides = require("sides"); | |
local ica = component.inventory_controller.address; | |
print("ICA: " .. ica) | |
local proxy = component.proxy(ica); | |
--Lets try to find our inventories | |
-- Top is the source | |
-- East is the output | |
print("Source inventory size: " .. proxy.getInventorySize(sides.top)); | |
-- Lets get all stacks from the inventory slots in Source | |
for i=0,proxy.getInventorySize(sides.top) do | |
local item = proxy.getStackInSlot(sides.top, i) | |
if item == nil then | |
print("No item in slot " .. i); | |
else | |
print(item.size .. " of " .. item.id .. " - " .. item.name); | |
end | |
end | |
print("all done!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment