View difference between Paste ID: SNSmv4W6 and Za2fYxyv
SHOW: | | - or go back to the newest paste.
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
17+
      if b[1]~="timer" and b[1]~="rednet_message" then
18
        break 
19
      else 
20
        nextEvent = b
21
      end
22
    end
23
  else 
24
    coroutine.resume(co,unpack(a))
25
  end 
26
end