binser + middleclass, I think I'm confused...
Posted: Sat Mar 23, 2019 7:54 pm
Hey all.
I'm hoping someone who has used a serializer and middleclass together can help me. I seem to be confused.
Tried, as a test, to serialize a middleclass class, and then deserialize it. Obviously, in the docs for binser, middleclass is a supported "custom" mapping for binser to use.
(binser URL: https://github.com/bakpakin/binser)
And yet, I can't seem to figure it out.
Basically, I made a junk test class "Testclass" with nothing but a initialize function and a "print some crap" function that printed "Yo momma!". Yep, I'm a full grown adult. Then I spawned an actual member of said class:
Then I tried what I'm supposed to do based off the binser docs:
So, basically I'm confused at that point. See, I understand how to declare this custom class for binser:
But have no idea how to proceed. I tried serializing testclass after I registered the class, which "works" kinda, but I don't think it's taking into account the middleclass class at all, since when I deserialize it, the member functions don't work (nil value, etc.). So, I'm not sure how to tell binser to use that registered way it knows how to deal with middleclass.
And the docs for it sort of skim over this aspect. I tried and tried, and feel I'm missing some simple step.
So, in short, can someone who has used this before point me in the right direction? How does one serialize and deserialize a middleclass class via binser? I registered the class, and then serialized it, but when deserialized, the class isn't really a class at all.
I hope that makes sense, as I'm quite tired and hope I didn't ramble on!
I'm hoping someone who has used a serializer and middleclass together can help me. I seem to be confused.
Tried, as a test, to serialize a middleclass class, and then deserialize it. Obviously, in the docs for binser, middleclass is a supported "custom" mapping for binser to use.
(binser URL: https://github.com/bakpakin/binser)
And yet, I can't seem to figure it out.
Basically, I made a junk test class "Testclass" with nothing but a initialize function and a "print some crap" function that printed "Yo momma!". Yep, I'm a full grown adult. Then I spawned an actual member of said class:
Code: Select all
testclass = Testclass()
Code: Select all
local class = binser.registerClass(class[, name])
Code: Select all
somevariable = binser.registerClass(testclass)
And the docs for it sort of skim over this aspect. I tried and tried, and feel I'm missing some simple step.
So, in short, can someone who has used this before point me in the right direction? How does one serialize and deserialize a middleclass class via binser? I registered the class, and then serialized it, but when deserialized, the class isn't really a class at all.
I hope that makes sense, as I'm quite tired and hope I didn't ramble on!