item-counter.lua

19 lines · 349 B

Open raw

Copy & run

wget https://perlytiara.github.io/turtles.tips/raw/programs/BigGamingGamers/item-counter.lua
1local SLOT_COUNT = 16
2
3
4function getCountOfItem(name)
5 count = 0
6 for i = 1, SLOT_COUNT, 1 do
7 d = turtle.getItemDetail()
8 if(d ~= nil) then
9 if(d['name'] == name) then
10 count = count + d['count']
11 end
12 end
13 end
14
15 return count
16end
17
18x = getCountOfItem('minecraft:bamboo')
19print(x)