[ZeroBrane Studio] Re: Debugging interoperation with middleclass.lua

  • From: Rob Probin <rob.probin@xxxxxxxxx>
  • To: zerobrane@xxxxxxxxxxxxx
  • Date: Thu, 13 Mar 2014 07:53:44 +0000

Assuming you are running from the debugger, then I think you haven't got the Object:__serialize added ... which means print(person) does the __tostring rather than __serialize.


The serialize is needed that the debugger shows something other than the opaque 'instance of class Person' in the debugger under, say, the stack window.


On 13/03/2014 07:02, Rob Probin wrote:
On 12/03/2014 23:22, Paul K wrote:
Hm, both of these work for me. I'm running the latest middleclass from github:

local Person = class('Person')
function Person:initialize(name) self.name = name end
function Person:speak() print('Hi, I am ' .. self.name ..'.') end

print(Person)
local person = Person()
print(person)
print(tostring(person))

-- output
class Person
instance of class Person
instance of class Person

Or am I doing something differently?

Paul.
Have you got the serialize method I added?




Other related posts: