mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 04:00:30 +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,
|
sProtocol = sProtocol,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local sent = false
|
||||||
if nRecipient == os.getComputerID() then
|
if nRecipient == os.getComputerID() then
|
||||||
-- Loopback to ourselves
|
-- Loopback to ourselves
|
||||||
os.queueEvent( "rednet_message", nReplyChannel, message, sProtocol )
|
os.queueEvent( "rednet_message", nReplyChannel, message, sProtocol )
|
||||||
|
sent = true
|
||||||
else
|
else
|
||||||
-- Send on all open modems, to the target and to repeaters
|
-- Send on all open modems, to the target and to repeaters
|
||||||
local sent = false
|
|
||||||
for n,sModem in ipairs( peripheral.getNames() ) do
|
for n,sModem in ipairs( peripheral.getNames() ) do
|
||||||
if isOpen( sModem ) then
|
if isOpen( sModem ) then
|
||||||
peripheral.call( sModem, "transmit", nRecipient, nReplyChannel, tMessage );
|
peripheral.call( sModem, "transmit", nRecipient, nReplyChannel, tMessage );
|
||||||
@ -96,6 +96,8 @@ function send( nRecipient, message, sProtocol )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return sent
|
||||||
end
|
end
|
||||||
|
|
||||||
function broadcast( message, sProtocol )
|
function broadcast( message, sProtocol )
|
||||||
|
Loading…
Reference in New Issue
Block a user