79 posts
Location
Germany
Posted 02 September 2013 - 03:48 PM
Hello Guys,
I just wanna run a function (maybe with parallel api) while i run normal shell & programs
Can you please help me fix my problem?
Thank u guys
79 posts
Location
Germany
Posted 02 September 2013 - 04:00 PM
Solved my self:
Code:
monitor = peripheral.wrap("right")
function doClock()
while true do
monitor.clear()
monitor.setCursorPos(1,1)
monitor.write(textutils.formatTime(os.time(),true))
sleep(0.01)
end
end
function doShell()
shell.run("shell")
end
parallel.waitForAny(doClock,doShell)
It would be nice if i find a better suggestion
1688 posts
Location
'MURICA
Posted 02 September 2013 - 04:07 PM
Yeah, you pretty much nailed it right there.
Also, for the record, sleep can only work in increments of 0.05, so 0.05, 0.10, 0.15 etc. will work, but 0.01 will just be upped to 0.05.
And for the future, whenever you don't feel like implementing multitasking functionality into your programs, a lot of operating systems / desktop environments / graphical shells allow multitasking capabilities:
Cannon OSCraftBangLyqydOSFlutter