Posted 29 January 2013 - 04:10 AM
Hello, this is what my current code is:
This is not the context that I am using, but it sort of is. I need the turtle to turn to var. I know I can use an if statement, but in my code that Im currently writing is an if statement not that usefull. Should I make a function or is it in 1 line possible to turn to var?
If it cant be in one line, I know how I could write the function, but I am trying to avoid this.
Thank you in advance.
NOTE: If this is not clear enough, plese say that, than I can try to define it better.
while true do
local var = nil
term.clear()
term.setCursorPos(1,1)
print("Turn left or right?")
read = lower.string(read())
if read == "left" then
var = "left"
break
elseif read == "right" then
var = "right"
break
end
end
turtle.turn -- Here it has to turn the variable var
This is not the context that I am using, but it sort of is. I need the turtle to turn to var. I know I can use an if statement, but in my code that Im currently writing is an if statement not that usefull. Should I make a function or is it in 1 line possible to turn to var?
If it cant be in one line, I know how I could write the function, but I am trying to avoid this.
Thank you in advance.
NOTE: If this is not clear enough, plese say that, than I can try to define it better.