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

Stuck

Started by Mendoza, 15 August 2014 - 12:35 PM
Mendoza #1
Posted 15 August 2014 - 02:35 PM
Hello, I have a problem.

My script is stuck: I have a parallel.waitForAny with 3 functions, but one function doesn´t let me continue because is waiting for an imput (io.read), and the parallel.waitForAny cannot stop that when fired.

The idea is that the script waits for an imput until the parallel.waitForAny is fired

I hope that someone can help me, thanks
MKlegoman357 #2
Posted 15 August 2014 - 02:42 PM
We cannot help without seeing the code. Also, note that you have to pass functions to parallel.* calls, not call them. In other words:


parallel.waitForAny(func1(), func2()) --// Incorrect usage

parallel.waitForAny(func1, func2) --// Correct usage
theoriginalbit #3
Posted 15 August 2014 - 02:43 PM
In the future please post your code, we can't really help much without it.

However based off your description I have a feeling your problem is one that is experienced often with people that do not know how the API works, I have an explanation here (which expands upon and explains what MKlegoman357 stated) that you can have a read through.
Edited on 15 August 2014 - 12:44 PM
Mendoza #4
Posted 15 August 2014 - 03:31 PM
Thanks MKlegoman357, now it works!