This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Pedroc1999's profile picture

How to terminate a program with in a program

Started by Pedroc1999, 30 October 2012 - 01:07 PM
Pedroc1999 #1
Posted 30 October 2012 - 02:07 PM
Hello i have managed to use a computer as a lever using a program, there are possible codes to enter, "open" opens the door and "close" closes it, I want to disable terminating a program, but i want a code to "return to OS" as in terminating the program without actually pressing Ctrl-t so opnly people who know the code can terminate my lock, if you wish to see the program so far tell me and i will upload it
Cranium #2
Posted 30 October 2012 - 02:10 PM
There are many ways of doing this, depending on ho your code is written. Go ahead and post your code, and we will see which is the best way. From your description, I think adding a break within your loop would accomplish this, but I have not seen your code yet, so I don't know for sure.
Doyle3694 #3
Posted 30 October 2012 - 02:11 PM

error()
I think that will do what you want(stop the program and return to shell)

put this at top:

os.pullEvent = os.pullEventRaw
to prevent CTRL+T
Pedroc1999 #4
Posted 30 October 2012 - 02:32 PM
sorry for being such a noob but how do we post the program?
Pedroc1999 #5
Posted 30 October 2012 - 02:35 PM
thank you doyle, that worked, but could you still tell me how to post programs
exploder #6
Posted 30 October 2012 - 02:47 PM
thank you doyle, that worked, but could you still tell me how to post programs


You can post program codes by clicking button called Code (it is located on the top second line and looks like this <>) then you paste your code inside the box that appears.