Skip to content

Instantly share code, notes, and snippets.

@dkowis

dkowis/testInventory.lua

Last active Aug 1, 2017
Embed
What would you like to do?
Learning some OpenComputers API
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
You can’t perform that action at this time.