Guest User

pause

a guest
Mar 7th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. local args = {...}
  2. if not args[1] then
  3.   print"Usage: pause application"
  4.   print"Then press f1 to pause while in that application, and then any key to unpause."
  5.   return false
  6. end
  7. local co = coroutine.create(function()
  8.   shell.run(args[1])
  9. end)
  10. local nextEvent={""}
  11. while true do --59 is f1
  12.   local a=nextEvent or {os.pullEvent()}
  13.   nextEvent = nil
  14.   if a[1]=="key" and a[2]==59 then
  15.     while true do
  16.       local b={os.pullEvent()}
  17.       if b[1]~="timer" then
  18.         break
  19.       else
  20.         nextEvent = b
  21.       end
  22.     end
  23.   else
  24.     coroutine.resume(co,unpack(a))
  25.   end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment