Difference between revisions of "Parallel.waitForAll"

From ComputerCraft Wiki
Jump to: navigation, search
(Created the page)
 
Line 8: Line 8:
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=Tells the computer to run function1 and function2 at the same time. Will broadcast what the User enters and prints what it receives over rednet. It will stop when it received a message and the usewr entered something.
+
|desc=Tells the computer to run function1 and function2 at the same time. Will broadcast what the User enters and prints what it receives over rednet. It will stop when it received a message and the user entered something.
 
|code=function1 = [[function]]()
 
|code=function1 = [[function]]()
 
   [[print]] ([[rednet.receive]]())
 
   [[print]] ([[rednet.receive]]())

Revision as of 02:15, 29 August 2012

Grid Redstone.png  Function parallel.waitForAll
Lets you run multiple functions at the same time.
Syntax parallel.waitForAll(function1, function2, so on)
Returns ?
Part of ComputerCraft
API parallel

Examples

Grid paper.png  Example
Tells the computer to run function1 and function2 at the same time. Will broadcast what the User enters and prints what it receives over rednet. It will stop when it received a message and the user entered something.
Code
function1 = function()
 print (rednet.receive())
end
function2 = function()
 rednet.broadcast (read())
end
parallel.waitForAll (function1, function2)
Output Prints what it received via rednet and broadcasts the message the user typed.