Component: Inventory Controller

Component name: inventory_controller

This component is provided by the inventory controller upgrade.

With this API the robot can receive additional information about items or inventories and is able to put items into and take them from specific slots.

Sides required for most operations are specified in the Sides API. If no or an invalid side is provided functions will usually throw an error. To interact with the robot's own inventory you need to use the side back, which however makes it impossible to interact with inventories behind the robot. Robots cannot access their left or right sides. You can interact with external inventories in front of, above, or below the robot.

Callbacks:

Example:

Print meta-info about the item in the position indicated by slot

snippet.lua
local component = require("component")
local sides = require("sides")
 
local slot = 1
local item = component.inventory_controller.getStackInInternalSlot(slot)
 
if item then
	print("Item name: ", item.name)
	print("Item count: ", item.size)
	print("Item damage: ", item.damage)
else
	print("Slot " .. slot .. " is empty")
end