Pinkishu

Untitled

May 26th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.30 KB | None | 0 0
  1. function utils.timeoutFunc(func,timeout, ...)
  2.     if timeout == nil then timeout = -1 end
  3.     local suc = true
  4.     local start = os.clock()
  5.     while not func(...) do
  6.         suc = false
  7.         if timeout == -1 then
  8.             break
  9.         elseif os.clock() > start + timeout then
  10.             break
  11.         end
  12.         suc = true
  13.     end
  14.     return suc
  15. end
Advertisement
Add Comment
Please, Sign In to add comment