Jump to content




Numbers...


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

#1 datdenkikniet

  • Members
  • 3 posts

Posted 16 December 2013 - 08:30 AM

So, I have this code already (I am trying to make my own chat program) but for some reason, the rednet.send() on line 26 won't work, because it requires a number. I thought I could do this by using tonumber(), but it doesn't work.
I would be very pleased if you could tell me how I can do this.
Thanks in advance
Datdenkikniet (Jona)

#2 Ajt86

  • Members
  • 42 posts

Posted 16 December 2013 - 11:15 AM

To use rednet.send, you need to provide two arguments, the channel and the message. All computers listening to that channel can receive the message. Here's an example:
id = 29
msg = "Hello, Computer #"..id
rednet.send(id, msg)

Edited by Ajt86, 16 December 2013 - 02:22 PM.


#3 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 16 December 2013 - 01:17 PM

View PostAjt86, on 16 December 2013 - 11:15 AM, said:

To use rednet.send, you need to provide two arguments, the channel and the message. All computers listening to that channel can receive the message. Here's an example:
id = 29
msg = "Hello, Computer #29"
rednet.send(29, msg)
I believe you mean
rednet.send(id, msg)


#4 Ajt86

  • Members
  • 42 posts

Posted 16 December 2013 - 02:22 PM

View PostCastform, on 16 December 2013 - 01:17 PM, said:

View PostAjt86, on 16 December 2013 - 11:15 AM, said:

To use rednet.send, you need to provide two arguments, the channel and the message. All computers listening to that channel can receive the message. Here's an example:
id = 29
msg = "Hello, Computer #29"
rednet.send(29, msg)
I believe you mean
rednet.send(id, msg)
I'll edit the post

#5 datdenkikniet

  • Members
  • 3 posts

Posted 16 December 2013 - 02:24 PM

Yes, but the string from the arguments used in chat <ID> where <ID> is the argument, should be converted in to an int, but it wont!

#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 16 December 2013 - 02:45 PM

Lua is one-indexed, not zero-indexed. Change line 26 to use both tonumber and the correct indexing:

rednet.send(tonumber(chatID[1]), "authentication!!!!")


#7 datdenkikniet

  • Members
  • 3 posts

Posted 16 December 2013 - 03:26 PM

View PostLyqyd, on 16 December 2013 - 02:45 PM, said:

Lua is one-indexed, not zero-indexed. Change line 26 to use both tonumber and the correct indexing:

rednet.send(tonumber(chatID[1]), "authentication!!!!")
Aha, thank you very very much Lyqyd





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users