Skip to main content
GameDev.net gamedev.net
🔒 Locked

Lua or Python

Started by Turt99 Apr 1, 2003 at 12:42 PM 22 replies 2.6k views
Original Post
Turt99
Turt99
I''m going to be researching Scripting Languages and I was wondering, which of these two is most Popular? My goal is to learn a system that is going to be the most useful outside of my project.. The project I''ll be using the scripting in is just a simple 2D RGP (Adventure) engine.. I don''t want to spend the time learning both I''d rather learn one really well.. Which of the 2 would you suggest and which of the 2 is going to be the most usefull for other projects.. The game engine will be written in C++ if that makes a difference.. and the entire project will have a Object Oriented Design if that helps in the decision Please visit Turt99 Productions
FOLLOW ME ON TWITTER OR MY BLOG
Arild Fines
Arild Fines
You should use Python because thats what I use.



"If there is a God, he is a malign thug."
-- Mark Twain
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Turt99
Turt99
quote:
Original post by Arild Fines
You should use Python because thats what I use.



"If there is a God, he is a malign thug."
-- Mark Twain



Well thats a great reason to use it... is there a reason why you choose to use Python? or are you using it because someone told you that they use it?



Please visit Turt99 Productions
FOLLOW ME ON TWITTER OR MY BLOG
Hazelnuss
Hazelnuss
*lol*

I would go for Lua... it is smaller, faster and IMHO easier to use with C/C++.
Turt99
Turt99
quote:
Original post by Hazelnuss
*lol*

I would go for Lua... it is smaller, faster and IMHO easier to use with C/C++.


Those are very strong points for Lua, so would you say that they are about the same in Popularity and Usefullness?

Python from what I''ve seen is its own langauge more so then Lua it seems.. (if that really makes any sence) .. Anyways at this point I think I''m going to lean towards Lua..


Please visit Turt99 Productions
FOLLOW ME ON TWITTER OR MY BLOG
Ziphnor
Ziphnor
I havent used Python at all, but ive heard alot of good things about it, and it has been used in commercial titles.

From what ive heard its probably too "powerful" for simple scripting, but thats just extrapolation. And besides this very fact might make it more useful to know in terms of stand alone languages.

Lua is extremelly simple and easy to use, and from what im learning about it, it still seems possible to do more sophisticated stuff with it(simple objects etc).

I would suggest comparing Python syntax vs Lua syntax and decide what you like best, if you still cant decide, take a look at basic embedding tutorials for both languages and see which API you prefer.


[edited by - ziphnor on April 1, 2003 3:19:39 PM]
the Speed Bump
the Speed Bump
Python is the heftier language, for better or worse. It scales extremely well. If you need a simple language, Python can do a great job of it; all its extra bells and whistles obligingly stay out of the way if you don't care about them. For more complex things, those bells and whistles are easy to (ab)use.

If executable size is an issue, then Python may not be for you.

I've not embedded Lua myself, but the API didn't really impress me much. (manually messing with stacks... egh) Lua has an undeniably smaller storage footprint, however. (my copy of python22.dll is 800kb)

I'm hip because I say "M$" instead of "MS".

[edited by - the speed bump on April 1, 2003 12:41:09 AM]
"There is only one everything"
Joviex
Joviex
LUA.... 1000000%

Did python, and if you feel like wasting time with embedding it, by all means. Yes it is powerful, yes it scales well, yes you can write extensions (same with LUA). But for ease of use it ain''t.

Python took me a few days to grasp, few more to embed. LUA I had going inside of an hour.

LUA is super tiny. It uses a very simple stack mechanism to get things going, and embedding it is so easy you don''t even have to use packages like toLUA if you can program out of a paper bag.

Not to mention fast. Python is fast, but its bloated as well.

Thems the facts from my skewed perspective.

"Five passengers set sail that day, for a three hour tour, a three hour tour...."
TWN
TWN
I am currently also doing some investigations into which scripting language to use.

LUA seems to be build for the purpose of embedding it in to your own program where as Python is a standalone programming language with the possibility to embed.

LUA seems much small and also simpler (which is what I need in my "game").

Both languages are here to stay so I say you take a short look at them both (spend one day with LUA and one with Python) and then make your decision.

If you still can't decide you go for the one you think has the coolest name ... kiddin'


[edited by - TWN on April 2, 2003 3:23:40 AM]
/TWN---I can't think of any "smart" remark right now! stay tuned!
Oluseyi
Oluseyi
What are your needs? If all you want is a flexible language to make portions of your codebase more dynamic (runtime evaluation without compilation), then Lua is more than adequate. If you want a powerful extension of your development process into an introspective environment, rapid prototyping and access to a host of functionality, choose Python.
Kylotan
Kylotan
quote:
Original post by Turt99
My goal is to learn a system that is going to be the most useful outside of my project..

It depends on what your 'other projects' are.

Python is possibly more useful in the outside world in that it's more than a scripting language. It's a fully-fledged language with lots of support. You could use it for web scripting, application development, an alternative for shell scripts, anything really.

On the other hand, Lua is small, compact, and easier to embed than Python (because that is what it exists for). If you're going to be working on a lot of projects that will require an embedded scripting language, Lua could be used over and over again to great effect.

quote:
I don't want to spend the time learning both I'd rather learn one really well..

Thankfully, these 2 'scripting' languages are fairly similar. As with many others, they tend to revolve around an all-powerful collection class and variant data types. Object orientation tends to come about by storing functions as one of the objects in the collection. (I think Python hides this from you now, though.) By learning one, you'll have a head-start on learning the other.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]


[edited by - Kylotan on April 2, 2003 6:18:43 AM]
Turt99
Turt99
Thanks for all the reply''s

I was reading about LUA last night and I like what I saw, it seemed very easy to use, and from what I saw it there are alot of other people using it as well (always good for when you have questions)

Now there was one comment that concerned me, in the Lua documentation it stated that it was designed for procedural programming, However my engine design is Object Oriented, is this going to cause a problem? I don''t see it as a huge problem, because I''m pretty sure I saw another post that was talking about Lua and classes.. (Something about luaStates and classes)

Note: when I said usefull outside of my project, I just meant things like, whats better on a resume, but like you said if they are similar then just knowing how to embed a scripting language is going to be what they are looking for..

Please visit Turt99 Productions
FOLLOW ME ON TWITTER OR MY BLOG
Hazelnuss
Hazelnuss
There is a thingy called "toLua" that will create Lua "classes" for you. And you can emulate class-like things with tables.
Turt99
Turt99
quote:
Original post by Hazelnuss
There is a thingy called "toLua" that will create Lua "classes" for you. And you can emulate class-like things with tables.


Great! I guess I didn''t get to that part yet.. that will work great then.. LUA it is then ..

Factors for using Lua
1) Smaller
2) Faster
3) Easier to embed
4) Easier to navigate their site (www.python.org I found akward)
5) More people recommended it here




Please visit Turt99 Productions
FOLLOW ME ON TWITTER OR MY BLOG
Arild Fines
Arild Fines
You should not use Perl because I don''t like it.



"If there is a God, he is a malign thug."
-- Mark Twain
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Turt99
Turt99
quote:
Original post by Arild Fines
You should not use Perl because I don''t like it.



"If there is a God, he is a malign thug."
-- Mark Twain



You Again? okay I won''t use it if you don''t like it

Perl actually sounds like a fairly good option.. I''m going to look into it a bit and see if its better then lua..



Please visit Turt99 Productions
FOLLOW ME ON TWITTER OR MY BLOG
Turt99
Turt99
quote:
Original post by crackingod
Do u gives have any resources(tuts, guides, code) for implementing python or LUA?



Lua
www.lua.org - Lua''s Website
http://gamestudies.cdis.org/~amatheson/LUA-Part01/Part01-section01.html - Write up on Lua, quick tut type article to show how it can be used

Python
www.python.org - Python''s Website

thats all I had on Python but there is alot of documentation there


Please visit Turt99 Productions
FOLLOW ME ON TWITTER OR MY BLOG
eldee
eldee
quote:
Original post by crackingod
Do u gives have any resources(tuts, guides, code) for implementing python or LUA?


here,here, or most obviously here.

-eldee
;another space monkey;
[ Forced Evolution Studios ]

::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

thehurricane
thehurricane
One factor (really a minor complaint, but still something to consider...) thing that turned me away from Python was the fact that indentation and whitespace was part of the syntax, I''ve never seen anything like it in any other languages and honestly I think it could get in the way, especially with lots of nesting and stuff like that. I like the flexibilty of Lua''s syntax.

On the other hand a MAJOR con for Lua is the fact there are very few good tutorials out there...to really reach a good understanding about how to use it WELL I think you almost have to dig in and really digest the manual. Things to look into are ToLua (which someone mentioned above, I think)--it really helps to automate the busywork needed for classes and object oriented stuff. Also you might want to try downloading a wrapper that abstracts functions and hides the underlying API stack structure so that things are easier...or you could write your own, it''s not THAT hard

And if you get Lua up and running in your game, I''d definitely think about implementing a console so you can change variables on the fly.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.