Considering picking up Lua
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Considering picking up Lua
Projects I've done without classes (of reasonable size) would quickly become a mess, sure, I agree, don't go learn classes before you grasp the language, but be sure to give it a look once you do. (Not saying you should use classes then either, but if it fits your workflow, please do, the freedoms of lua!)
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Considering picking up Lua
Totally agree with what kikito said. It took me a while to grasp OOP, but I didn't put it off as long as I could; since I got it, I couldn't code without it. Unless the problem domain is tiny, neglecting to think about architecture, is best illustrated by a bridge builder who needs to make a crossing across a large river, but doesn't want to think about the architecture.
If thought isn't taken to architecture, everything is a mess. In the analogy of the builder, this situation would be the same as all his materials lying all over the place.
Shifting from procedural to OOP, doesn't make your stop thinking about problems and solutions. You still think about those same problems, but have good architecture to help you implement a clean solution. Of course, for simple stuff (tiny problems), I still use procedural, it's most certainly the best way to go in that case. But when things get bigger, OOP is like pain relief for a massive headache.
Anyway, I should probably stop now; I'm an OOP nut, so I like to defend it.
If thought isn't taken to architecture, everything is a mess. In the analogy of the builder, this situation would be the same as all his materials lying all over the place.
Shifting from procedural to OOP, doesn't make your stop thinking about problems and solutions. You still think about those same problems, but have good architecture to help you implement a clean solution. Of course, for simple stuff (tiny problems), I still use procedural, it's most certainly the best way to go in that case. But when things get bigger, OOP is like pain relief for a massive headache.
Anyway, I should probably stop now; I'm an OOP nut, so I like to defend it.
Re: Considering picking up Lua
Hate to quote myself but I feel that you quoted me out of context.
And of course I agree with all the statements about OOP being difficult and taking time to grasp. It is an incredibly abstract concept after all. I hope this is all helpful to the original poster by the way
As early as possible. Which means that you should get a grasp of the fundamentals first, of course. I like to balance out my arguments.Lafolie wrote:...the only problems I can foresee with using Löve are OOP and network-functionality. Both of these issues, however, are pretty much negated...
... though I would recommend learning the fundamentals of object-orientation as early as possible...
And of course I agree with all the statements about OOP being difficult and taking time to grasp. It is an incredibly abstract concept after all. I hope this is all helpful to the original poster by the way
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Re: Considering picking up Lua
Concerning OOP then, how difficult is it to get some sort of class system going?
Re: Considering picking up Lua
As simple as
There's one on the wiki, with varying degrees of complexity, each with their own examples and explanations. If you're absolutely new to scripting then I'd suggest you get a hang of the basics first
Code: Select all
require("3rdparty_script")
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Considering picking up Lua
By the do you mean, how difficult is it to create an OOP system in Lua or how difficult is OOP to learn?Spade wrote:Concerning OOP then, how difficult is it to get some sort of class system going?
If the former, then it doesn't take a lot of code at all (anywhere from 20 to 150 or so lines is pretty good). However it does take a solid knowledge of Lua, especially a good grasp on tables, metatables, and functions (and most likely closures).
If the latter, it really depends on the person. It usually does take a little while to get, that's my experience anyway.
EDIT: Oh yeah, you could of course use a third-party OOP system. I highly suggest MiddleClass.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Considering picking up Lua
MiddleClass is rather complex. Especially if you're new to all this, SECS might be easier to use.BlackBulletIV wrote:EDIT: Oh yeah, you could of course use a third-party OOP system. I highly suggest MiddleClass.
Help us help you: attach a .love.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Considering picking up Lua
Complex? I find it really simple (unless you're talking about hacking around with internals, like swapping metatables and stuff), certainly more simple than other language's OOP system. All you've gotta remember is
That's simple isn't it?
Code: Select all
NameForClass = class('NameForClass', OptionalSuperClass)
function NameForClass:initialize(...)
-- initialize here
end
-- other functions created the same way
instance = NameForClass:new() -- or NameForClass()
Re: Considering picking up Lua
I disagree with you both! I'm using bartbes' latest OOP invention: https://bitbucket.org/bartbes/slither/overview
I personally find it easier to use than both of the above. But eh, each to their own.
I personally find it easier to use than both of the above. But eh, each to their own.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Considering picking up Lua
Slither looks pretty cool syntax wise, although I hate the funcName = function() stuff.
But indeed, each to their own.
But indeed, each to their own.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 4 guests