I don't know if the title is understandable, but for example, I have this countdown and in a separate line, let's say "term.setCursorPos(1,3)" I want to write something, anything, but with the countdown running all the time.
Thank you and apologize my english!
Im going to assume you want to function running at the same time as each other. If so then parallel events is possibly what you want, or maybe coroutines, but heres an example for parallel events:
function countdown()
for i = 1, 10, 1 do
--# do stuff
sleep(0)
end
end
function main()
--# Doing stuff in here
end
parallel.waitForAll(countdown, main)
--# This parallel will wait for both function to finish before continuing with the rest of the program
parallel.waitForAny(countdown, main)
--# whereas this parallel will wait for any of the functions to finish, and then continue, so if you have a while loop in main, it will be STOPPED when the countdown function is done.
--# You can have more than two functions running at a time:
parallel.waitForAny(func1, func2, func3, func4, etc...)
With this code you can have your coundown running in the background, and have main with the rest of the code you want to run whilst the countdown continues. Let me know if this is what you're after.