summaryrefslogtreecommitdiff
path: root/cactus.lua
blob: 6da8880fef82f407fe801f66b6a3e76e23feb0cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)
			turtle.equipLeft()
			return true
		end
	end
	return false, "couldn't find "..item
end

ensure_equipped "plethora:module_scanner"