475 posts
Posted 17 August 2012 - 04:08 PM
Hi everyone! =D
This is probably a noob question but how do I make a program run for a certain amount of time then stop? Thanks.
3790 posts
Location
Lincoln, Nebraska
Posted 17 August 2012 - 04:13 PM
It depends on the program running. Some cases you can just have it sleep for a certain amount of time, and os.shutdown(), other times you would need to use some timers and os.pullEvent()… What kind of program are you running? Could you post the code?
475 posts
Posted 17 August 2012 - 04:23 PM
Well I wanted to continuously print something for lets say 10 seconds then stop.
463 posts
Location
Germany
Posted 17 August 2012 - 04:34 PM
Code:
function a()
shell.run("theprogram")
end
function b()
sleep(10)
end
parallel.waitForAny(a, :(/>/>
(This is a program to run the program "theprogram" for 10 secs)
3790 posts
Location
Lincoln, Nebraska
Posted 17 August 2012 - 04:37 PM
Code:
function a()
shell.run("theprogram")
end
function b()
sleep(10)
end
parallel.waitForAny(a, :(/>/> --your code here called for "B", and we needed "b"
(This is a program to run the program "theprogram" for 10 secs)
Slight correction.