1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-16 10:09:55 +00:00

Send the original rednet message to the current computer

We were incorrectly enquing the modem payload, not the underlying rednet
message.

Closes #1308.
This commit is contained in:
Jonathan Coates 2023-01-21 08:23:00 +00:00
parent 12f2f854a6
commit b46ad62424
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
2 changed files with 9 additions and 1 deletions

View File

@ -193,7 +193,7 @@ function send(recipient, message, protocol)
local sent = false
if recipient == os.getComputerID() then
-- Loopback to ourselves
os.queueEvent("rednet_message", os.getComputerID(), message_wrapper, protocol)
os.queueEvent("rednet_message", os.getComputerID(), message, protocol)
sent = true
else
-- Send on all open modems, to the target and to repeaters

View File

@ -37,6 +37,14 @@ describe("The rednet library", function()
expect.error(rednet.send, nil):eq("bad argument #1 (expected number, got nil)")
expect.error(rednet.send, 1, nil, false):eq("bad argument #3 (expected string, got boolean)")
end)
it("queues an event on the current computer", function()
rednet.send(os.getComputerID(), "Test message")
local id, message = rednet.receive(1.0)
expect(id):eq(os.getComputerID())
expect(message):eq("Test message")
end)
end)
describe("rednet.broadcast", function()