Lua vs Python

Please compose all posts in Emacs.

Moderators: phlip, Moderators General, Prelates

SwiftSilent
Posts: 36
Joined: Sun Dec 15, 2013 6:59 pm UTC
Location: ---

Lua vs Python

Postby SwiftSilent » Mon Dec 16, 2013 12:10 am UTC

I'm new to this forum. So if I place this topic in an irrelevant category, my apologies.

I'm currently growing an interest in the world of coding. But frankly, I'm only a newbie. To give you an idea of what kind of newbie I am, I basically can't define what a compiler or syntax is.

Anyways, I'm considering to start with either Lua or Python. I hear Lua is a very quick language to pick up. But I've also heard that Python is more kind of broad programming language that gives you more capabilities.

If you have any suggestions on which language I should start with, it would much be appreciated. Some resources for me to learn from would also be helpful.

Thanks.

lalop
Posts: 210
Joined: Mon May 23, 2011 5:29 pm UTC

Re: Lua vs Python

Postby lalop » Mon Dec 16, 2013 6:09 pm UTC

Not sure this is really a religious war, but:

Python. I'd give it a minor to moderate edge in ease of learning (at worst, they're about comparable) and it has more power (in the sense of programming features), libraries, and tools.

Where Lua shines is in its lightweightness, which has led to it being embedded as a scripting language for many games, as well as LaTeX. Since it doesn't sound like you need that right away, go with python first (once you learn the first language, subsequent ones are much easier to pick up).

SwiftSilent
Posts: 36
Joined: Sun Dec 15, 2013 6:59 pm UTC
Location: ---

Re: Lua vs Python

Postby SwiftSilent » Mon Dec 16, 2013 10:30 pm UTC

So if that is the case, how often would I use Python? Where is it used most nowadays? Games, apps...


“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.”
---Albert Einstein---


lalop
Posts: 210
Joined: Mon May 23, 2011 5:29 pm UTC

Re: Lua vs Python

Postby lalop » Tue Dec 17, 2013 2:13 am UTC

Use it as often as you want. Assuming you don't have a programming project, you'd probably use it for the occasional script - it's one of the most convenient languages for doing so.

You'd really only use LUA if you're writing an embedded script for something that uses LUA.

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Lua vs Python

Postby EvanED » Tue Dec 17, 2013 2:27 am UTC

Yeah, Python is used all over the place for (usually) relatively small programs and scripts. Lua's more popular for embedding an interpreter in a larger program written in C++ or something (you'll run into the occasional program that uses Python for that purposes, but a lot of people consider it to be a bit heavyweight for that), but Python is a far more popular language for standalone use. You'd definitely be well-served with Python as your first language if you don't have something very specific that can "only" be done in Lua. I'd say it's more popular, there is a bigger community, and there are a lot more beginner resources. For example, MIT's intro CS class is now in Python, and available on OCW. (Python isn't a universal choice for such a class, but MIT's not nearly alone in it either. And I'm unaware of any that start with Lua.)

SwiftSilent
Posts: 36
Joined: Sun Dec 15, 2013 6:59 pm UTC
Location: ---

Re: Lua vs Python

Postby SwiftSilent » Tue Dec 17, 2013 4:52 am UTC

Well thanks for the tips. It's really much appreciated. I'll definitely make sure to take a look into Python. :)


“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.”
---Albert Einstein---


User avatar
Jplus
Posts: 1721
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Lua vs Python

Postby Jplus » Tue Dec 17, 2013 9:46 am UTC

Definitely start with Python. You should also learn Lua (and several other languages) but that can wait.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

SwiftSilent
Posts: 36
Joined: Sun Dec 15, 2013 6:59 pm UTC
Location: ---

Re: Lua vs Python

Postby SwiftSilent » Wed Dec 18, 2013 12:38 am UTC

Right now, I'm also working on HTML & CSS. Would you guys recommend me to learn Python at the same time or wait and finish HTML?


“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.”
---Albert Einstein---


EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Lua vs Python

Postby EvanED » Wed Dec 18, 2013 12:47 am UTC

I'd say it's up to you.

One other alternative though, since you've already started down that path a little, is to go Javascript.

SwiftSilent
Posts: 36
Joined: Sun Dec 15, 2013 6:59 pm UTC
Location: ---

Re: Lua vs Python

Postby SwiftSilent » Wed Dec 18, 2013 2:51 am UTC

EvanED wrote:I'd say it's up to you.

One other alternative though, since you've already started down that path a little, is to go Javascript.

I've been considering that as well. Especially since its part of web design.

Anyways, I really appreciate the help. It's going to help me a lot! :D


“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.”
---Albert Einstein---


User avatar
Jplus
Posts: 1721
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Lua vs Python

Postby Jplus » Wed Dec 18, 2013 11:33 am UTC

It's also noteworthy that Javascript and Lua have very similar properties. If you know one, learning the other will not add much to your general understanding of programming (though it may still be useful for scripting purposes of course).
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

SwiftSilent
Posts: 36
Joined: Sun Dec 15, 2013 6:59 pm UTC
Location: ---

Re: Lua vs Python

Postby SwiftSilent » Wed Dec 18, 2013 2:15 pm UTC

Jplus wrote:It's also noteworthy that Javascript and Lua have very similar properties. If you know one, learning the other will not add much to your general understanding of programming (though it may still be useful for scripting purposes of course).

Alright that'll be nice to know.

BTW, what is the difference between the purposes of JavaScript & Java? Is one mainly for the web and the other more for desktop applications like Minecraft?


“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.”
---Albert Einstein---


EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: Lua vs Python

Postby EvanED » Wed Dec 18, 2013 2:29 pm UTC

Don't let the names fool you... Java and JavaScript are very far apart in terms of the language and have effectively nothing to do with one another. It's probably not very helpful for me to spout out keywords as to how they differ. :-)

In terms of uses: JavaScript, of course, is mostly used for client-side scripting on the web, but it is creeping into other places as well (e.g. local programs), using node. Java is... I'm not sure, but I'd guess it's most popular for server-side programming (e.g. when you load a web page like this one that is generated dynamically, a program is running on the server to make it), but it's also used for local applications as well and the occasional Java applet you see.

User avatar
Jplus
Posts: 1721
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Lua vs Python

Postby Jplus » Wed Dec 18, 2013 3:02 pm UTC

It's not so clear-cut. Javascript is also sometimes used on the server side (this is actually the main purpose of Node.js). Java applets basically serve the same purpose as client-side javascripts. Java has more language features that facilitate programming "in the large" than Javascript, but since it's quite memory-hungry it's still not ideal for that purpose.

Ironically, despite the languages being almost entirely unrelated except for the names (as EvanED said) and the C-style syntax, the main difference in use is shown most succinctly by the names. Javascript is typically embedded in larger software (a website or a game). In other words, it's mostly used for scripting something. Java is mostly used in a standalone fashion. Both can be used in the opposite way as well, but in both cases that's less common and when it happens, Java space scripts (applets) are usually still more complex than embedded Javascript while standalone Javascript programs are usually smaller than Java applications.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

johnie104
Posts: 248
Joined: Tue Jan 08, 2008 6:44 pm UTC
Contact:

Re: Lua vs Python

Postby johnie104 » Sat Jan 25, 2014 9:21 pm UTC

Both Python and Lua are very elegant languages.

Python is elegant because reading a well programmed Python script is almost like reading english, and the standard installation comes with so many libraries that for a LOT of usage case you don't need to download another library.
Lua is elegant because it has only 3 datatypes (string, float and table), of which tables forms the meat of the language. It's also very lightweight and the de-facto scripting language for a lot of games (World of Warcraft and Supreme Commander spring to mind). It's also easy to learn: Learn LUA in 15 minutes
Signature removed because of it's blinding awesomeness.

User avatar
untitled
Posts: 39
Joined: Wed Jan 29, 2014 9:23 pm UTC

Re: Lua vs Python

Postby untitled » Wed Feb 05, 2014 12:15 am UTC

if you are so disrespectful not to learn C (from the K&R book, of course), at least learn python. i must warn you, python does not have a "for" loop like C ( the most useful tool in the hands of a noob/lazy programmer!!). after you learn python (and/or Lua and/or C...) you can mix them all together. till ye get here, though, it will take ye some bean and thyme. if you want to study computer science, go right ahead, it will make you write programs much faster later on (and generate a lot more swearing from your colleagues when they find Lua bound to C bound to Python bound to Lua, without comments and spread out in 33 files)

edit: grammar and clarification


Return to “Religious Wars”

Who is online

Users browsing this forum: No registered users and 5 guests