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

Block Read()

Started by svdragster, 10 August 2013 - 06:43 AM
svdragster #1
Posted 10 August 2013 - 08:43 AM
Hey,

I'm doing some coroutine stuff, and I'm running the shell while another program is running in the background.
I can switch between them with pressing TAB. Everything works great, except that I can still type stuff to the screen.
I have overwritten the read an write functions, so it won't print anything of them, but I can't find out how I can block read().

Can anyone help me block read() so it won't do anything as long as a bool is true?
Bubba #2
Posted 10 August 2013 - 10:42 AM
If you don't want to stop programs that use timers from running, just make sure that key and character events go only to the currently active coroutine, but let all the other events to go to every coroutine. That way, timers and other events like redstone will continue to work with background programs, but typing will only go to the forefront program.

If you want background programs to actually stop, then only resume the active coroutine.