Jump to content




[not a bug][1.?-1.63][SSP/SMP]textutils.serialize with multiline strings



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

#1 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 05 May 2014 - 08:07 PM

ComputerCraft Version Information: Found using CC 1.63. I suspect this bug appeared either in CC 1.6 or earlier.

Description of Bug:
textutils.serialize doesn't serialize strings with newlines correctly and makes it impossible to unserialize it using textutils.unserialize.

Screenshot:
Posted Image


Not a bug. It's just how print function prints it.

Note to myself: check before posting, so you wouldn't waste your or anyone else's time...

Edited by MKlegoman357, 06 May 2014 - 10:08 AM.


#2 CometWolf

  • Members
  • 1,283 posts

Posted 05 May 2014 - 08:39 PM

Why would you serialize a lone string in the first place...? I assume this happens if it's contained in a table aswell?

#3 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 05 May 2014 - 09:09 PM

View PostCometWolf, on 05 May 2014 - 08:39 PM, said:

Why would you serialize a lone string in the first place...? I assume this happens if it's contained in a table aswell?

Yes it does, textutils.serialize serializes everything that is in a table using itself.

I was testing my program, serializing a table and saving it to a file, and found this problem. I'm actually wondering how long this bug exists because I don't think Dan changed all of the serialize function when he updated to CC 1.6 and I think this bug may be living since the creation of this function...

EDIT:

View PostCometWolf, on 05 May 2014 - 08:39 PM, said:

Why would you serialize a lone string in the first place...?

If you're creating a config file and want values to be properly serialized before saving them, IDK.

Edited by MKlegoman357, 05 May 2014 - 09:14 PM.


#4 CometWolf

  • Members
  • 1,283 posts

Posted 05 May 2014 - 10:05 PM

The serialize function was changed to make it's output more readable in 1.6. He added newlines to it, so it might be related. I can test this in 1.58 tomorrow just to be sure though.

#5 Bomb Bloke

    Hobbyist Coder

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

Posted 06 May 2014 - 12:06 AM

It works the same way prior to 1.6x.

Note "works" - textutils.unserialise() has no problems with that output.

Nice to see there's a textutils.unserialise() in 1.6, by the way.

#6 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

Posted 06 May 2014 - 01:32 AM

View PostBomb Bloke, on 06 May 2014 - 12:06 AM, said:

It works the same way prior to 1.6x.

Note "works" - textutils.unserialise() has no problems with that output.

Nice to see there's a textutils.unserialise() in 1.6, by the way.

True - it just looks funky when you try to print it cause print in lua program prints serialized table again.
Also s thing. You would not believe how many times it happened to me.

Edited by wojbie, 06 May 2014 - 01:33 AM.


#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 06 May 2014 - 05:29 PM

Moved to Ask a Pro by request.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users