On 12/03/2014 22:51, Rob Probin wrote:
In the remote console, whilst running my code (at a breakpoint) print(#Person) and print(pairs(Person)) work for me as well. But why wouldn't it call the metamethods? (maybe I'm missing something obvious...)What do you do to get this error? I tried the following (including the earlier fix for __serialize): local Person = class('Person') print(#Person) And it prints 0 without any errors.
Because it's using the Class metatable not the object metatable.... e.g. print(Person) shows: "class Person" Rather than "instance of Person" Try: test = Person() print(tostring(test)) "instance of class Person" print(test).../middleclass.lua:66: class Person doesn't implement metamethod '__len'