Guest User

frp

a guest
Feb 18th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. --Fisher Rednet Protocol
  2. --Made by Fisher Medders - FisherMedders.com
  3. --Free of use but do give credit.
  4. --Started on 2/18/17 - In a hotel for SEWE 2017
  5.  
  6. function receive( protocol, timeout )
  7.   if timeout == nil then
  8.     evnt = {os.pullEvent( "rednet_message" )}
  9.     if string.find( evnt[3], protocol..":" ) then
  10.       args = argify( evnt[3] )
  11.     end
  12.   else
  13.     if tonumber( timeout ) then
  14.       evnt = {rednet.receive()}
  15.       args = argify( evnt[2] )
  16.     else
  17.       error("Receive was not nil, was also not a number.")
  18.     end
  19.   end
  20.   return args
  21. end
  22.      
  23. function argify( argstr )
  24.   args = {}
  25.   for arg in string.gmatch( evnt[3], '([^:]+)' ) do
  26.     table.insert( args, arg )
  27.   end
  28.   return args
  29. end
Advertisement
Add Comment
Please, Sign In to add comment