What I'm trying to make now - is a branch mining program. And I don't want my turtle to mine useless blocks, so I have a number of slots with "useless" blocks - such as smoothstone, dirt, gravel and so on, and let the turtle compare the block and each of useless blocks before mining. Here is my function:
function isUseful (side, range)
for i=1,range do
turtle.select(i)
if tCompare[side]() then
turtle.select (1)
return false
end
end
turtle.select (1)
return true
end
tCompare is just a table containing all the compare function, so I can pass a side to the "isUseful" function, and not make all the "isUsefulUp", "isUsefulDown" stuff. "range", basically, means how many slots contain "useless" blocks.
So issue is time. If that block is not "useless", turtle hangs for a second or even more, while it checks all the "useless" slots (there are six of them)
There are two ways to fix this issue:
First one - is to make turtle.select() work faster. I'm not sure if it is possible.
Secont one - is to introduce a new function, which compares a block in the <slot> to a block to the <side> of turtle without selecting that slot.
And I'm sorry for my bad English since I'm not a native speaker….