Update class.lua

fixed some memory management issues, as well as improvements to multiple inheritance

there is, however, a big issue with calling methods, which may not be fixed for a while