7 posts
Posted 12 October 2014 - 01:17 PM
Hello i was wondering if you could cancel a program as soon as a turtles fuel level is below a certain amount?
like a: turtle.getFuelLevel() if turtle.getFuelLevel() < 100 then (cancel code)
598 posts
Location
The United States
Posted 12 October 2014 - 02:19 PM
You can use an empty error function like so:
error()
All it does is silently terminate the program, just like it would if you held down CTRL-T. (Except for the lack of the Terminated message.)
7 posts
Posted 12 October 2014 - 05:42 PM
Ty Jiloacom
598 posts
Location
The United States
Posted 12 October 2014 - 09:23 PM
Ty Jiloacom
No problem man. ;)/>
9 posts
Posted 21 November 2014 - 02:16 PM
Just curious. (as a decent answer was given already)
Would something like " If condition exists then exit " work.
I am new to both CC and LUA so am interested in this as part of an error handler routine.
598 posts
Location
The United States
Posted 21 November 2014 - 07:19 PM
Just curious. (as a decent answer was given already)
Would something like " If condition exists then exit " work.
I am new to both CC and LUA so am interested in this as part of an error handler routine.
I believe the only "exit" function that exists, is either return/break (return, which if you're in a function, ends the function; break, which if you're in a loop, ends the loop), or error (already explained).
Edited on 21 November 2014 - 06:19 PM
9 posts
Posted 26 November 2014 - 10:44 AM
Thanx, that helps explain which exit strategy to use.