so with the parallel api,
So do I just do this or what ? :
function func1()
os,pullEvent("chat_message")
end
function func2()
--do stuff
end
while true do
prarallel.waitForAny(func1,func2)
end
Posted 24 August 2014 - 12:39 AM
function func1()
os,pullEvent("chat_message")
end
function func2()
--do stuff
end
while true do
prarallel.waitForAny(func1,func2)
end
Posted 24 August 2014 - 12:55 AM
Edited by Dragon53535, 24 August 2014 - 01:01 AM.
Posted 24 August 2014 - 12:56 AM
Posted 24 August 2014 - 01:19 PM
Posted 24 August 2014 - 01:21 PM
Posted 24 August 2014 - 01:31 PM
Posted 24 August 2014 - 01:53 PM
function f1()
while true do
local e, msg = os.pullEvent( "chat_message" )
print( e .. " - " .. msg )
end
end
function f2()
while true do
rs.setOutput( "right", not rs.getOutput( "right" ) )
sleep( 1 )
end
end
parallel.waitForAny( f1, f2 )
Edited by KingofGamesYami, 24 August 2014 - 01:53 PM.
Posted 24 August 2014 - 01:56 PM
Posted 24 August 2014 - 02:26 PM
Posted 24 August 2014 - 02:35 PM
Posted 24 August 2014 - 02:46 PM
local id = os.startTimer( 1 )
while true do
local event = { os.pullEvent() }
if event[ 1 ] == "chat_message" then
print( event[ 1 ] .. " - " .. event [ 2 ] )
elseif event[ 1 ] == "timer" and event[ 2 ] == id then
rs.setOutput( "right", not rs.getOutput( "right" ) )
id = os.startTimer( 1 )
end
end
Posted 24 August 2014 - 02:49 PM
Posted 24 August 2014 - 02:51 PM
Posted 24 August 2014 - 02:52 PM
Posted 24 August 2014 - 03:03 PM
0 members, 1 guests, 0 anonymous users