ComputerCraft

ComputerCraft

21M Downloads

sleep() doesn't work right.

SoniEx2 opened this issue ยท 1 comments

commented

http://www.computercraft.info/forums2/index.php?/topic/22861-1710-sleep-sleeping-for-incorrect-amount-of-ticks/

A workaround is to call sleep(0.05) in a loop:

function fixsleep(n)
  sleep(n % 0.05) -- at least a 1-tick sleep
  for i=2,math.floor(n * 20) do
    sleep(0.05)
  end
end
commented

fixed