summaryrefslogtreecommitdiff
path: root/cactus.lua
blob: 508d0fa264f7330f9f3526a6681870b661aa18c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
local function ensure_equipped(item)
	local cur = peripheral.getType"left"
	if cur == item then return true end
	for i = 1,16 do
		local det = turtle.getItemDetail(i)
		if det and det.name == item then
			turtle.select(i)
			return turtle.equipLeft()
		end
	end
	return false, "couldn't find "..item
end

print(ensure_equipped "computercraft:wireless_modem_normal")