serialize a middleclass-class with binser
Posted: Mon Oct 30, 2017 7:13 pm
Hi,
I am stucked in the use of binser and hoping someone can help me. I suppose it's not a big problem (therefore I'm worried about making a extra thread about it )
Question:
Is there a quick example of an small middleclass-class and a serializing and deserializing per binser?
For example:
I am stucked in the use of binser and hoping someone can help me. I suppose it's not a big problem (therefore I'm worried about making a extra thread about it )
Question:
Is there a quick example of an small middleclass-class and a serializing and deserializing per binser?
For example:
Code: Select all
--somewhere in the main:
Account = class('Account')
require "classes/Account"
--in classes/Account.lua:
function Account:initialize()
self.id = "test-id"
self.name = "test-name"
self.level = 0
self.xp = 0
end
--in an other file:
-- does not work, I don't catch it
local account_to_send = Account:new()
binser.registerClass(Account)
local myddata = binser.serialize(account_to_send)
binser.unregister(Account)