Posted 17 September 2014 - 09:37 AM
So either I'm stumped or the fact that its 4:30 in the morning is making me oblivious, but I can't seem to figure out the issue. Error is: program:11: attempt to compare __lt on nil and number
here is the snippet having issues
This is where the myx myy myz is called
I have put the snippet into its own program to further debug. I don't get any errors, but it also doesn't print anything
basically the turtle gets its coords from the GPS then it moves once and it gets the Coords again. it then figures out if it was less than or greater than the first set to determine what direction the turtle is facing
any and all help that could be provided would be much appreciated!
here is the snippet having issues
function face()
local facing = Unknown
turtle.forward()
local x, y, z = gps.locate()
if x ~= myx then
if x > myx then --this is line 11
facing = East
end
if x < myx then
facing = West
end
end
if z ~= myz then
if z > myz then
facing = South
end
if z < myz then
facing = North
end
end
end
This is where the myx myy myz is called
local myx, myy, myz = gps.locate()
I have put the snippet into its own program to further debug. I don't get any errors, but it also doesn't print anything
basically the turtle gets its coords from the GPS then it moves once and it gets the Coords again. it then figures out if it was less than or greater than the first set to determine what direction the turtle is facing
any and all help that could be provided would be much appreciated!