Guest User

Untitled

a guest
Jun 5th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.43 KB | None | 0 0
  1. function receive(waitTime)
  2.   if waitTime and type(waitTime) == "number" then
  3.     local timer = os.startTimer(waitTime)
  4.     while true do
  5.       local event, timerEvent = os.pullEvent("timer")
  6.       if timerEvent == timer then break end
  7.       local event = {os.pullEvent("modem_message")}
  8.       if event[3] == channel then
  9.         return event[5], event[2]
  10.       else
  11.         print("Received nil")
  12.       end
  13.     end
  14.   end
  15. end
Advertisement
Add Comment
Please, Sign In to add comment