Page 2 of 2
Re: Serial- A serialization library (Who would have guessed?
Posted: Wed Jun 22, 2011 8:22 pm
by Robin
That is because of this line:
Code: Select all
buffer[ size ] = serializeValue( data, "_" )
size is still 1 at that point. It boils down to:
Code: Select all
buffer[ 1 ] = serializeValue( data, "_" )
which is NOT what you want.
A simple way of fixing this would, if I am correct, be this:
Code: Select all
local final = serializeValue( data, "_" )
buffer[size] = final
That way
size is evaluated
after serializeValue is called, and not before.
Re: Serial- A serialization library (Who would have guessed?
Posted: Wed Jun 22, 2011 8:43 pm
by whitewater
Robin wrote:That is because of this line:
Code: Select all
buffer[ size ] = serializeValue( data, "_" )
size is still 1 at that point. It boils down to:
Code: Select all
buffer[ 1 ] = serializeValue( data, "_" )
which is NOT what you want.
A simple way of fixing this would, if I am correct, be this:
Code: Select all
local final = serializeValue( data, "_" )
buffer[size] = final
That way
size is evaluated
after serializeValue is called, and not before.
Oh, thanks! I figured it out about 30 seconds before I just now came here and posted this though, so...
Re: Serial- A serialization library (Who would have guessed?
Posted: Wed Jun 22, 2011 9:00 pm
by whitewater
Updated
Now supports recursive tables (eg t.loop = t), I forgot to mention that I added support for functions without upvalues, is still mostly unoptimized until I can work out any bugs I may or may not find.
Oh! And it now serializes to a function deserialize, returning the table.
Re: Serial- A serialization library (Who would have guessed?
Posted: Wed Jun 22, 2011 10:53 pm
by whitewater
Fixed a bunch of bugs dealing with recursive tables, and one silly one.
Re: Serial- A serialization library (Who would have guessed?
Posted: Fri Jun 24, 2011 4:47 am
by whitewater
It sounds like I'm just talking to myself at this point, but for those who care
I've done a few updates (fixed bugs, etc), but the real reason for my post is
this which should function as a drop in replacement for Image and Framebuffer, but I don't know my way around Love2d all that well, so I need to know if I missed hooking any functions, bugs, etc, but I don't want to make a new topic just for this.
Re: Serial- A serialization library (Who would have guessed?
Posted: Fri Jun 24, 2011 7:18 am
by Robin
Good work! Don't know what that has to do with serialization any more, though.
I wouldn't call it a drop in replacement, though, as the lover will have to change all calls to love.graphics.newImage to PaddedImage.new.
Also, 0.8.0 will do the padding automatically on computers that need it.
Re: Serial- A serialization library (Who would have guessed?
Posted: Fri Jun 24, 2011 2:36 pm
by whitewater
Aw.
I could replace all calls, but now its completely pointless. Oh well. (And I've done updates, but nobody seems to care, so I stopped posting.) Also, don't all computers arguably 'need it' since power of 2 images will be faster pretty much always (afaik)?