Share your repls and programming experiences

← Back to all posts
Sleep Function (For Lua)
ChristianKeith (0)

#Sleep Function

function sleep(Time,Notify)
  local StartTime = os. time()
  repeat until os.time() > StartTime + Time -0.5
  if Notify ~= nil then
    print("Wait Notification: "..Notify)
  return true

This is a sleep function I made (Check out the repl to see it in action feel free to use it.)

Coder100 (17091)

Just want to let you know using while loops for sleeping really really eats up cpu

ChristianKeith (0)

Thanks for the advice Ill note it