Jump to content




How to stop the program continuing (in code)

lua

  • You cannot reply to this topic
9 replies to this topic

#1 os.reboot()

  • New Members
  • 13 posts

Posted 22 July 2012 - 12: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().

#2 Teraminer

  • New Members
  • 175 posts
  • LocationDon't look behind you..

Posted 22 July 2012 - 12:57 PM

you mean just stop or stop and wait for something?

#3 os.reboot()

  • New Members
  • 13 posts

Posted 22 July 2012 - 01:00 PM

View PostTeraminer, on 22 July 2012 - 12:57 PM, said:

you mean just stop or stop and wait for something?

Like exit the program and go back to the OS's command line.

#4 KevinW1998

  • Members
  • 93 posts
  • LocationAustria(German)

Posted 22 July 2012 - 01:03 PM

you need only use "return" or you can use "error()" while you are in function

#5 os.reboot()

  • New Members
  • 13 posts

Posted 22 July 2012 - 01:37 PM

View PostKevinW1998, on 22 July 2012 - 01:03 PM, said:

you need only use "return" or you can use "error()" while you are in function

Thank you!

#6 Teraminer

  • New Members
  • 175 posts
  • LocationDon't look behind you..

Posted 23 July 2012 - 10:01 AM

No need for that just end your program.And when it ends it will automaticly "put" you in the OS command line.

#7 kotorone1

  • New Members
  • 20 posts

Posted 24 July 2012 - 04:10 AM

shell.programs() perhaps?
that should exit whatever you are running immediately

#8 Noodle

  • Members
  • 989 posts
  • LocationSometime.

Posted 24 July 2012 - 08: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.

#9 AlejoAy

  • New Members
  • 1 posts

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

Edited by AlejoAy, 21 November 2012 - 01:01 PM.


#10 cmurtheepic

  • Members
  • 158 posts
  • Locationthe vast cosmos of my mind; binary!

Posted 21 November 2012 - 01:22 PM

you could use.
term.clear()
end
at the end of your program.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users