I don't want to hear about os.reboot() and os.shutdown().
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
How to stop the program continuing (in code)
Started by os.reboot(), 22 July 2012 - 11:44 AMPosted 22 July 2012 - 01:44 PM
I'm making a command for a program ".exit" and it needs to stop the program immediately.
I don't want to hear about os.reboot() and os.shutdown().
I don't want to hear about os.reboot() and os.shutdown().
Posted 22 July 2012 - 01:57 PM
you mean just stop or stop and wait for something?
Posted 22 July 2012 - 02:00 PM
you mean just stop or stop and wait for something?
Like exit the program and go back to the OS's command line.
Posted 22 July 2012 - 02:03 PM
you need only use "return" or you can use "error()" while you are in function
Posted 22 July 2012 - 02:37 PM
you need only use "return" or you can use "error()" while you are in function
Thank you!
Posted 23 July 2012 - 11:01 AM
No need for that just end your program.And when it ends it will automaticly "put" you in the OS command line.
Posted 24 July 2012 - 05:10 AM
shell.programs() perhaps?
that should exit whatever you are running immediately
that should exit whatever you are running immediately
Posted 24 July 2012 - 09:27 AM
^ Will not. It continues if you are in a loop.
Run a function that simply doesn't exist. It'll return an error :)/>/> only problem is no-clear.
If inside a loop (while true) then use break.
Run a function that simply doesn't exist. It'll return an error :)/>/> only problem is no-clear.
If inside a loop (while true) then use break.
Posted 21 November 2012 - 01:00 PM
i had the same problem,
you can use an if statment like so
while true do
if input == x then
elseif input == "2" then
elseif input == "3" then
elseif input == "4" then
break
else
end
end
yo can break the loop when you want, just by adding "break", you can also as i did use multiple elseif statments and place the brake where you need it.
I hope this help you
you can use an if statment like so
while true do
if input == x then
elseif input == "2" then
elseif input == "3" then
elseif input == "4" then
break
else
end
end
yo can break the loop when you want, just by adding "break", you can also as i did use multiple elseif statments and place the brake where you need it.
I hope this help you
Edited on 21 November 2012 - 12:01 PM
Posted 21 November 2012 - 01:22 PM
you could use.
term.clear()
end
at the end of your program.