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

textutils.serialize() and unserialize

Started by Kenzo, 31 December 2014 - 05:29 AM
Kenzo #1
Posted 31 December 2014 - 06:29 AM
so im trying to send a couple of variables over rednet using textutils.serialize() and unserialize but its giving me an error every time it unserializes

"sender, message = rednet.receive()
mail = textutils.unserialize(message)

account = mail[1]
func = mail[2]
p1 = mail[3]
p2 = mail[4]
p3 = mail[5]"

any idea why?
Bomb Bloke #2
Posted 31 December 2014 - 06:43 AM
What's the sending code look like? What does the error look like?

If it's throwing an attempt to index nil, then that would imply that whatever message is being received isn't a valid serialised table. You could try printing "message" to ensure it's what you think it should be.