Need voice of experience.

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Trappingnoobs
Citizen
Posts: 95
Joined: Tue Oct 12, 2010 8:52 pm

Re: Need voice of experience.

Post by Trappingnoobs »

schael wrote:
Trappingnoobs wrote:I use an OOP implementation I made
I now understand why I don't understand OOP with LUA :ehem:
What do you mean?
User avatar
schael
Prole
Posts: 27
Joined: Mon Jul 11, 2011 5:13 pm
Location: France

Re: Need voice of experience.

Post by schael »

I mean that it means Lua is not an OO language . Isn't it ?
I'm learning...
User avatar
Trappingnoobs
Citizen
Posts: 95
Joined: Tue Oct 12, 2010 8:52 pm

Re: Need voice of experience.

Post by Trappingnoobs »

schael wrote:I mean that it means Lua is not an OO language . Isn't it ?
No, it's not, I don't think; but it's easy to implement, and much easier to code with it (Well, the majority of people, including me, think that).

Middleclass is probably the most-used one here, but I'm not fussed with it or most of the other implementations; since they only, as far as I know (I could be wrong so don't hold me to this), allow single inheritance, eg

Class1
Class2
Subclass inherits from Class1

Subclass can't inherit from both classes, only one, and nothing can inherit from it.

I made my own which basically is:

Class "ClassName" {Properties}
Class "InheritsfromClassName" ( {Properties}, {ClassName} )

Looks wierd, but you're basically passing either one or two tables in.

And you can inherit from as many as you like, and you can inherit from classes that have already inherited from other classes, just like a real OOP language.

So it's not hard to implement; and it can save you a lot of time.
User avatar
schael
Prole
Posts: 27
Joined: Mon Jul 11, 2011 5:13 pm
Location: France

Re: Need voice of experience.

Post by schael »

Middleclass is a part of PÄSSION right ? I will not use it for my first project but I will learn more about.
I'm learning...
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Need voice of experience.

Post by bartbes »

No, middleclass is separate now.

And, btw, Trappingnoobs, you have observed wrong, I know for a fact that SECS has a version with multiple inheritance, and Slither does it by default too.
User avatar
Trappingnoobs
Citizen
Posts: 95
Joined: Tue Oct 12, 2010 8:52 pm

Re: Need voice of experience.

Post by Trappingnoobs »

bartbes wrote:No, middleclass is separate now.

And, btw, Trappingnoobs, you have observed wrong, I know for a fact that SECS has a version with multiple inheritance, and Slither does it by default too.
Can you have classes that inherit from classes that inherit from other classes?

What about default values?

Edit

I can't use SECS because I'm 14 and it wouldn't end up good for me if my parents saw that on my computer. I doubt they'd beleive it's to do with programming :L
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Need voice of experience.

Post by bartbes »

..., seriously? I have yet to find a class system that doesn't do that..
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Need voice of experience.

Post by Kadoba »

Honestly, from what I've seen it's better to avoid OOP altogether when you first start out in Lua. Lua takes a different mindset than OOP languages and 90% of the time you can get by with simple metatables. OOP is built IN Lua rather than INTO Lua and a lot of people just can't seem to get around that.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Need voice of experience.

Post by BlackBulletIV »

Trappingnoobs wrote:I can't use SECS because I'm 14 and it wouldn't end up good for me if my parents saw that on my computer. I doubt they'd beleive it's to do with programming :L
Ah ha! Yeah, I'm definitely not a supporter of suggestive library names, they just get in the way.
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Need voice of experience.

Post by slime »

You can just rename it, you know.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests