Jump to content




How to protocols work in rednet?


  • You cannot reply to this topic
3 replies to this topic

#1 Agent Silence

  • Members
  • 319 posts
  • Location[string "FindMe"]:23143: bad argument #1 to 'returnPos' (vector expected, got nil)

Posted 05 January 2015 - 05:16 AM

Im rewriting the rednet api and im confused on how rednet handles protocols. There is no protocol found in modem.transmit for me so im a little confused

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 05 January 2015 - 05:23 AM

It goes in the packet structure rednet uses, under the key "sProtocol". Take a look through the rednet API code and you should see how it's used.

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 05 January 2015 - 06:16 AM

As a basic outline, rednet.send takes your message, the protocol, and one or two other bits of info, and bungs them in a table. That table then gets sent via modem.transmit, and the receiving computer repackages it as a rednet event at the other end (within rednet.run, which runs in parallel with the shell on all systems whether you ask for it or not - including those which don't have modems connected at all).

Prior to CC 1.6, there's no table encapsulation - the message just gets modem.transmit'd more or less as-is, and rednet.run thus has a slightly more simplistic job.

#4 Agent Silence

  • Members
  • 319 posts
  • Location[string "FindMe"]:23143: bad argument #1 to 'returnPos' (vector expected, got nil)

Posted 05 January 2015 - 06:30 AM

Alright, so as I interpreted, it sends a table? Thank you! That helps me a lot





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users