🔒 Locked
Python or Lua?
Advertisement
Original Post
I have decided to learn a scripting language to compliment my ever growing knowledge of C++ and Java. I have narrowed it down to Lua and Python. I was wondering which one you guys prefer (I do not fanboyish answers; please give at least a reason or two why you prefer it). I have done some research on both of these languages and could not find a decent comparison of them (for example pros and cons of each), so if you know of any links please send them. Thank You
The most relevant:
Lua V. Python
Some other food for thought:
Other Lua Comparisons
Python Comparisons
Language Shoot-Out
I think you should identify what your requirements are in a language and determine how well either one meets them. If you are learning simply to expand your toolbox then by all means learn both, or at least learn the basics of both and then choose the one you most enjoy tackling its advanced topics.
Lua V. Python
Some other food for thought:
Other Lua Comparisons
Python Comparisons
Language Shoot-Out
I think you should identify what your requirements are in a language and determine how well either one meets them. If you are learning simply to expand your toolbox then by all means learn both, or at least learn the basics of both and then choose the one you most enjoy tackling its advanced topics.
To Zorbfish: Thank you for the links, that is what I was looking for. I was mainly just looking to expand my toolbox. I am going to take your advice and learn both. I think that I will learn Python first, but will still learn Lua at a different time.
To JVFF: I probably will also learn Ruby as well but it will be a while before I get the time to properly learn it.
Thank You for your help
To JVFF: I probably will also learn Ruby as well but it will be a while before I get the time to properly learn it.
Thank You for your help
For general purpose use, Python is probably more useful than Lua due to
- Much greater wealth of libraries (standard, third party and ready made bindings of primarily C/C++ libraries)
- ctypes and Jython
- Fancy but useful language features, which make difficult tasks less difficult
- Much greater wealth of libraries (standard, third party and ready made bindings of primarily C/C++ libraries)
- ctypes and Jython
- Fancy but useful language features, which make difficult tasks less difficult
I prefer to write Python rather than Lua. Python's syntax appeals to me more and the features of the language are nifty. However, I've never used it in something as performance-demanding as a game; I've heard it holds up rather well, but I don't have first hand experience with it.
Python by far. I wouldn't say I know lots about Lua, but playing with it I got a feeling it was just different, but didn't bring tons of new things to the table...ie more work to learn, but it won't really make you write code faster. But that is just with a little Lua I learned.
Python has a much bigger community and has a following outside of games. A few people don't like python's syntax, but most people love it....I swear by it. It is a joy to program in. I completely dumped Perl after a week using python. Now I use it for most of my scripting needs.
Reasons
1) Clean syntax
2) OO has some goofy stuff like its encapsulation, but much better than Perl
3) Easy to download libraries and install
4) wxPython an excellent GUI framework
5) Scipy and other science frameworks are mature enough to actually use
6) People can use it with C...not simple, but not real hard
7) Did I mention nice syntax????
Python has a much bigger community and has a following outside of games. A few people don't like python's syntax, but most people love it....I swear by it. It is a joy to program in. I completely dumped Perl after a week using python. Now I use it for most of my scripting needs.
Reasons
1) Clean syntax
2) OO has some goofy stuff like its encapsulation, but much better than Perl
3) Easy to download libraries and install
4) wxPython an excellent GUI framework
5) Scipy and other science frameworks are mature enough to actually use
6) People can use it with C...not simple, but not real hard
7) Did I mention nice syntax????
I was once deciding between lua and python. i never managed to get python working. somebody on this forum suggested lua and i've been using it since. use it for all sorts of things even parts of physics models.
Python is much more sophisticated. But Lua has struck a magical balance as a lightweight embeddable language because it is so small and easy to embed in C programs. Porting lua to other operating environments is painless.
Just be careful programming in Lua, it is meant for simple tasks, so don't expect complex programs to be easy to write or maintain! ;)
Just be careful programming in Lua, it is meant for simple tasks, so don't expect complex programs to be easy to write or maintain! ;)
I was very tempted by Lua's simplicity over Python's complexities for embedding, but what killed it for me is that Lua doesn't have a concept of an undefined variable. If I misspell something then it will silently return nil, and bugs like that can easily go unnoticed. I also think Lua's idea of OO is pretty weak (including : vs . for method calls), and I wanted something I could introduce to a non-programmer with the least possible confusion.
My opinion:
Ruby has the nicest, most natural syntax but is pretty slow (if I wasn't making a game it would be my first choice... maybe in a year or two when YARV is finished) I use it at work all the time.
Python has very nice syntax too (although not quite as elegant and natural as Ruby) and is pretty fast. Its much bigger than Lua which is a disadvantage if you are only making a small game and don't want the dependencies.
Lua is small, lean, and overall the fastest of the three. It does have some language quirks though that can be annoying (taped-on OO, index from 1, default to global variable declaration etc). I wouldn't want to build anything big in Lua, but as an embedded scripting/configuration language it works well.
All IMHO of course, language debates have a tendency to escalate into unconstructive name-calling...
Summing up:
- If you want to embed a scripting language in your game, pick Lua.
- If you want to extend some engine of yours and write the game in a scripting language pick Python.
- If you just want to learn another language to extend your "toolbox" ruby is definatly the way to go.
Ruby has the nicest, most natural syntax but is pretty slow (if I wasn't making a game it would be my first choice... maybe in a year or two when YARV is finished) I use it at work all the time.
Python has very nice syntax too (although not quite as elegant and natural as Ruby) and is pretty fast. Its much bigger than Lua which is a disadvantage if you are only making a small game and don't want the dependencies.
Lua is small, lean, and overall the fastest of the three. It does have some language quirks though that can be annoying (taped-on OO, index from 1, default to global variable declaration etc). I wouldn't want to build anything big in Lua, but as an embedded scripting/configuration language it works well.
All IMHO of course, language debates have a tendency to escalate into unconstructive name-calling...
Summing up:
- If you want to embed a scripting language in your game, pick Lua.
- If you want to extend some engine of yours and write the game in a scripting language pick Python.
- If you just want to learn another language to extend your "toolbox" ruby is definatly the way to go.
Quote:
Original post by ShadowCyborgNinja
I have decided to learn a scripting language to compliment my ever growing knowledge of C++ and Java. I have narrowed it down to Lua and Python. I was wondering which one you guys prefer (I do not fanboyish answers; please give at least a reason or two why you prefer it). I have done some research on both of these languages and could not find a decent comparison of them (for example pros and cons of each), so if you know of any links please send them.
Thank You
If you're looking for a comparison which includes Lua, I would recommend reading this article, and its followup implementation article. It involves GameMonkey, an open-source C-esque scripting language (and incidentally is not about Lua, though it includes a brief introductory comparison in article #1).
Not sure if it interests you, but I was recently turned on to GameMonkey, thought I would spread the word. ;)
Cheers!
- DH
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement