This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
LegoMaster616's profile picture

[1.481][SMP/SSP]Rednet.Send will not accept an integer as the message

Started by LegoMaster616, 07 January 2013 - 10:42 AM
LegoMaster616 #1
Posted 07 January 2013 - 11:42 AM
Reproducible in all versions

When passing an integer into the message field of rednet.send(), "rednet:350: string expected" is printed.
Lua functions usually can take integers in place of strings.
Lyqyd #2
Posted 07 January 2013 - 11:44 AM
tostring() your intended message.
Cloudy #3
Posted 07 January 2013 - 11:46 AM
Maybe Lua functions usually can - but this one can't. Just pass a string. Is it really that hard? :P/>
LegoMaster616 #4
Posted 07 January 2013 - 11:50 AM
Didn't see tostring() in the lua reference manuals… so thank you. I'm sending integer variable information so I couldn't send it without tostring()
NeverCast #5
Posted 07 January 2013 - 12:51 PM
I believe textutils.serialize will serialize just numbers too.
I use it always when sending stuff over rednet, it allows you to send entire tables, serialized in to strings. It's fantastic.
Dlcruz129 #6
Posted 07 January 2013 - 02:48 PM
I believe textutils.serialize will serialize just numbers too.
I use it always when sending stuff over rednet, it allows you to send entire tables, serialized in to strings. It's fantastic.

Or just use tostring(), which is much shorter and less confusing to new users.