Serializing objects

BlitzMax Forums/BlitzMax Programming/Serializing objects

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

grable, this was really handy! But I ran into problems with my particle system while deserializing -- most values were read in correctly, but it broke on the first float and exited early, then after fixing that, it broke on the first negative number. So here are two minor fixes to this serializer to get it to load floats and negative numbers.

In Codecs.bmx, change line 231 to this:

		ElseIf (c >= Asc("a") And c <= Asc("z")) Or (c >= Asc("A") And c <= Asc("Z")) Or c = Asc("_") Then


which removes "c =Asc("-")" so that tokens starting with - are read as numbers once you also change line 242 to

		ElseIf (c >= Asc("0") And c <= Asc("9")) Or c = Asc("-") Then


Finally, there was code in there to handle floats, but it was in a while loop that would never parse a period. Change line 246 to

			While (c >= Asc("0") And c <= Asc("9")) Or c = Asc(".")


Works great now, thanks!