mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-13 11:40:29 +00:00
rednet.send now returns if the message was send (#164)
This makes use of the "sent" variable, which would otherwise go unused. It also makes rednet.send compliant to the behaviour specified in the Wiki: http://www.computercraft.info/wiki/Rednet.send
This commit is contained in:
parent
e4ef92ca2d
commit
390575ab4d
@ -81,13 +81,13 @@ function send( nRecipient, message, sProtocol )
|
||||
sProtocol = sProtocol,
|
||||
}
|
||||
|
||||
local sent = false
|
||||
if nRecipient == os.getComputerID() then
|
||||
-- Loopback to ourselves
|
||||
os.queueEvent( "rednet_message", nReplyChannel, message, sProtocol )
|
||||
|
||||
sent = true
|
||||
else
|
||||
-- Send on all open modems, to the target and to repeaters
|
||||
local sent = false
|
||||
for n,sModem in ipairs( peripheral.getNames() ) do
|
||||
if isOpen( sModem ) then
|
||||
peripheral.call( sModem, "transmit", nRecipient, nReplyChannel, tMessage );
|
||||
@ -96,6 +96,8 @@ function send( nRecipient, message, sProtocol )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return sent
|
||||
end
|
||||
|
||||
function broadcast( message, sProtocol )
|
||||
|
Loading…
Reference in New Issue
Block a user