function 1() while true do ... end end function 2() while true do ... end end parallel.waitForAny( 1(), 2() )
4 replies to this topic
#1
Posted 24 June 2012 - 11:38 PM
So i looked this up in the wiki and i still have a question. I am making this server thing and i need the 1 computer to do multiple functions. I am using the parallel api and was wondering if this code is possible...
#2
Posted 24 June 2012 - 11:44 PM
Almost, you don't have to call the functions, and function names can't be just numbers.
local function f1()
while true do
...
end
end
local function f2()
while true do
...
end
end
parallel.waitForAny(f1, f2)
Also, you can have as many functions as you want.
#3
Posted 24 June 2012 - 11:51 PM
and so i can have several functions that never end?
#4
Posted 24 June 2012 - 11:52 PM
Yes, just remember to add a yield (os.pullEvent or something like that) to the functions.
#5
Posted 24 June 2012 - 11:52 PM
OK! there will be plenty of that
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











