I think i am doing something or at least understood it wrong.
If i am creating a timer os.startTimer(2) i can let it save the returned specified code into a variable:
local refresh = os.startTimer(2)
everytime the timer gets tiggered, i reset the timer.
In my code i am having read(). I think that it pauses the timer, but i am not 100% sure on this. If it does pause it wouldnt be a problem, however if it does i would have to check, if the read() was longer then the remaining time of the timer.
So i am basically dont want to have two or more timers running, because i have to start a new timer somewhere in the code and messes up the refresh.
local refresh = os.startTimer(2)
local counter = 1
while true do
local event = {os.pullEvent()}
if event[1] == "timer" and event[2] == refresh then
refresh = os.startTimer(2)
counter = counter + 1
print(counter)
elseif event[1] == "char" then
read()
-- do i have to add a check for the old timer and create a new one here?
end
end
I hope that was clear :S
unobtanium












