serialize a middleclass-class with binser

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Dudenheit
Prole
Posts: 5
Joined: Wed Dec 17, 2014 7:40 am

serialize a middleclass-class with binser

Post by Dudenheit »

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 :death: )

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)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests