Posted 22 March 2013 - 08:37 PM
I'm suggest new functions:
turtle.remember(), turtle.rememberUp(), turtle.rememberDown(), turtle.RememberFrom(slotNum)
returns new type of variables, memBlock
turtle.compareFromMemory(memBlock), turtle.compareFromMemoryUp(memBlock), turtle.compareFromMemoryDown(memBlock), turtle.compareFromMemoryTo(memBlock,slotNum)
works like other compare functions but use memBlock type var to compare
why turtles can't do it? If it able to compare object in inventory it must be able to simply remember it to memory.
but, it's totally may be broke ID-blackList-suggestions, if that functions will be return some value of standart lua code, or value that will be unprotected from read or type by another functions.
var type block must be used only for thats functions. In other cases it must cause exception and break of code.
turtle.remember(), turtle.rememberUp(), turtle.rememberDown(), turtle.RememberFrom(slotNum)
returns new type of variables, memBlock
turtle.compareFromMemory(memBlock), turtle.compareFromMemoryUp(memBlock), turtle.compareFromMemoryDown(memBlock), turtle.compareFromMemoryTo(memBlock,slotNum)
works like other compare functions but use memBlock type var to compare
--example
---[[
some code there
]]---
turtle.select(16)
print("give me charcoal please in active slot, and press <Enter>")
read()
--user give us charcoal!
--That may be not a charcoal, but he is charcoal!!!
--My MASTER say that.
local charcoal=turtle.rememberFrom(16)
---[[
some code there
]]---
--finding charcoal in chest at front of turtle
--and putting it's in chest down
select(1)
turtle.dropDown()
while turtle.suck() do
if turtle.compareFromMemory(charcoal,1) then
print("I'm found charcoal, Master!")
turtle.dropDown()
break
end
turtle.dropDown()
end
why turtles can't do it? If it able to compare object in inventory it must be able to simply remember it to memory.
but, it's totally may be broke ID-blackList-suggestions, if that functions will be return some value of standart lua code, or value that will be unprotected from read or type by another functions.
var type block must be used only for thats functions. In other cases it must cause exception and break of code.