Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Fisher Rednet Protocol
- --Made by Fisher Medders - FisherMedders.com
- --Free of use but do give credit.
- --Started on 2/18/17 - In a hotel for SEWE 2017
- function receive( protocol, timeout )
- if timeout == nil then
- evnt = {os.pullEvent( "rednet_message" )}
- if string.find( evnt[3], protocol..":" ) then
- args = argify( evnt[3] )
- end
- else
- if tonumber( timeout ) then
- evnt = {rednet.receive()}
- args = argify( evnt[2] )
- else
- error("Receive was not nil, was also not a number.")
- end
- end
- return args
- end
- function argify( argstr )
- args = {}
- for arg in string.gmatch( evnt[3], '([^:]+)' ) do
- table.insert( args, arg )
- end
- return args
- end
Advertisement
Add Comment
Please, Sign In to add comment