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

How to run multiple programs at once without delaying any of them

Started by Explosives flyer, 15 July 2013 - 11:06 AM
Explosives flyer #1
Posted 15 July 2013 - 01:06 PM
Is it possible to run multiple programs at the same time (not like with shell.run(), which seems to execute the parameter program and then continue with the one it is called in), something like parallel.waitForAny(), only not with functions but with programs?
I have tried things like parallel.waitForAny(shell.run(prog1),shell.run(prog2)), but it starts executing prog 1 and ignores the rest of the parallel.waitForAny().
Any help would be appreciated
Lyqyd #2
Posted 15 July 2013 - 01:09 PM
Split into new topic.

You have to pass functions to parallel calls, not call the functions in the invocation. Use anonymous functions to do this if parallel is all you need:

parallel.waitForAny(function() return shell.run("program") end, function() return shell.run("secondProgram") end)
Explosives flyer #3
Posted 15 July 2013 - 01:20 PM
Thanks! My prog seems to work now!