1140 posts
Location
Kaunas, Lithuania
Posted 05 May 2014 - 09: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:
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 on 06 May 2014 - 09:08 AM
1281 posts
Posted 05 May 2014 - 09: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?
1140 posts
Location
Kaunas, Lithuania
Posted 05 May 2014 - 10:09 PM
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: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 on 05 May 2014 - 08:14 PM
1281 posts
Posted 05 May 2014 - 11: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.
7083 posts
Location
Tasmania (AU)
Posted 06 May 2014 - 01: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.
724 posts
Location
Kinda lost
Posted 06 May 2014 - 02:32 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.
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 on 06 May 2014 - 12:33 AM
8543 posts
Posted 06 May 2014 - 06:29 PM
Moved to Ask a Pro by request.