Best way to define classes

Hello,

I have been reading some blog posts and other documentation here on the Corona site, and I am still not sure what is the recommended approach to creating classes.

So far, I have narrowed it down to two approaches, one with meta tables and one without:

[lua]-- Cat Class

Cat = {}

Cat.new = function()
self = {}

self.property = “value”
self.method = function(params)

end

return self
end

– Dog Class

local Dog = {}
local Dog_mt = { __index = Dog }

function Dog.new()
local newDog = {
property = “value”

}

return setmetatable( newDog, Dog_mt )
end

function Dog:someMethod()

end

return Dog[/lua]

Can anyone share some knowledge, and explain which is better?
I must admit I am not completely following Lua’s metatable concept yet. [import]uid: 145050 topic_id: 26813 reply_id: 326813[/import]