Usage of CoronaPrototype and inheritance?

Hello,

Currently I’m using CoronaPrototype to make classes as follow:

local Prototype = require("CoronaPrototype") local MyClass = Prototype:newClass("MyClass") function MyClass:initialize(params) ... --usage: local obj = MyClass:new({name = "Bob"})

I understand that I could inherit from MyClass in following way:

local SecondClass = MyClass:newClass("Second") function SecondClass:initialize(params)

But I noticed that when I do MyClass:newClass call initialize function from MyClass get called (with nil params)

So should I handle params == nil and skip initialization? (in example above I want to set self.name = params.name, so params should always be passed)

Also documentation for CoronaPrototype is pretty brief. Does anybody using this or some other library for OOP?

My favorite solution is 30Log: https://github.com/Yonaba/30log

I’ve been playing around with Lua Class Library - OOP for Lua made easy which seems very promising.

$14.95 for functionality which you can get for free looks weird

The $15 must be for training materials and perhaps the authors implementation of an OOP solution.

Seems reasonable to charge for one’s labor to me.

@roaminggamer - Yeah, I was happy to pay $15 simply to see how they solved problems and structured their code for OOP.  It will definitely save me $15 worth of time and I’m always happy to support lua/Corona innovators.  Speaking of which Ed, I think I’ve purchased everything you have ever offered for sale and it’s always been worth a few bucks to see how someone else solved a problem and to not have to reinvent the wheel again and again, so thanks!

Does anybody using this or some other library for OOP?

If you’ve not done so, read the OOP chapter in Programming in Lua.

Something that went up a few hours ago, from the Legend of Grimrock programmer: Object decomposition in Druidstone (If you find this approach interesting, see also Evolve Your Hierarchy)

Thanks @StarCrunch.

Yes, I decided not to use inheritance and use components instead.

But I’m still curious about CoronaPrototype - seems like nobody used it. Why it was implemented in engine, does it have any difference from other oop libraries? Hope some of engine developers can answer this

My favorite solution is 30Log: https://github.com/Yonaba/30log

I’ve been playing around with Lua Class Library - OOP for Lua made easy which seems very promising.

$14.95 for functionality which you can get for free looks weird

The $15 must be for training materials and perhaps the authors implementation of an OOP solution.

Seems reasonable to charge for one’s labor to me.

@roaminggamer - Yeah, I was happy to pay $15 simply to see how they solved problems and structured their code for OOP.  It will definitely save me $15 worth of time and I’m always happy to support lua/Corona innovators.  Speaking of which Ed, I think I’ve purchased everything you have ever offered for sale and it’s always been worth a few bucks to see how someone else solved a problem and to not have to reinvent the wheel again and again, so thanks!

Does anybody using this or some other library for OOP?

If you’ve not done so, read the OOP chapter in Programming in Lua.

Something that went up a few hours ago, from the Legend of Grimrock programmer: Object decomposition in Druidstone (If you find this approach interesting, see also Evolve Your Hierarchy)

Thanks @StarCrunch.

Yes, I decided not to use inheritance and use components instead.

But I’m still curious about CoronaPrototype - seems like nobody used it. Why it was implemented in engine, does it have any difference from other oop libraries? Hope some of engine developers can answer this