Why Lua and Python are so popular?

Started by
49 comments, last by GameDev.net 19 years, 6 months ago
I have my scripting engine - NerveBreak - available at the net for around nine months now. However, until now there are only 2-3 persons who seemed interested in it (only one uses it "frequently" - all these "stats" are from forum posts and e-mails sent to me). While i'm developing NerveBreak mostly for my own use in my games (and software), i wondered why other people prefer to use Lua and/or Python, which have a worse -in my eyes at least- syntax and they're (in Python's case) too bloated, instead of using other libraries which seems -to me- better suited for C/C++ developers, such as NerveBreak, &#106avascript and AngelScript, because of their C-like syntax. So, what's your option and if you use Lua, Python or any other "famous" library with obscure syntax, why you decided to use that lib instead of anything else?
--Slashstone - www.slashstone.comNerveBreak free scripting system.
Advertisement
I use Lua.

First of all, popularity doesn't equal quality, but it brings several advantages. I can trust Lua to be well tested and to have taken into acount a lot of user feedback (particularly as there have been several versions around). I can also trust it will get updated and bugs will get fixed.

Secondly, Lua is a terrific language. Dynamic typing, excellent data description means (Lua tables _rock_), garbage collection, closures, coroutines. The syntax is brilliantly elegant and simple, and together with the light weight of the language it can obscure the fact that Lua is a very powerful language.
Besides lua is user expansive, for instance you can alter the lua language to support class :D
I use Lua and like its syntax, I can extend it, it is pretty fast, it's widely used and there are books written about it.
Firstly, I don't think it's fair to call Python 'bloated'. It is big, true, but that's because it's a fully-featured programming language. I agree that it's not exactly lightweight to embed in a host application but that matters less and less these days.

I think the mistake you're making is to assume that they have 'obscure' syntax. Lua and Python have very simple syntax - yes, they're somewhat different from C and C++, but they're simpler. This means they're quick to learn, so the difference isn't a problem. It also means non-programmers can learn it more quickly and easily, which is very important for a scripting language that is going to be used by designers and maybe even artists.

They also include high level facilities that most C-like languages won't have, such as simple uniform iteration over a structure, and associative arrays. I won't touch a scripting language without either of those because they make life a lot simpler.

Finally, people using scripting languages need a degree of support. They want to know that there are people who have experience with the language and who can offer advice. Given the choice between 2 similar languages, even if NerveBreak can offer all the facilities that Lua can, people are going to tend towards the language that has been proven (Lua has been used by Bioware and LucasArts in professional games, and more recently in FarCry and Painkiller) and which has many users able to lend assistance. Also, I don't see any documentation on your site. It's hard for someone to compare it to their needs if they can't see all the functionality.
I haven't used your language but I intend to at least try it at some point in the future. I don't like Lua, the stack accessing makes me mad as it feels that this sort of method should be wrapped up better. I tried GameMonkey which was ok, but again I haven't used it extensively. I'm yet to try AngelScript and NerveBreak but intend to at some point soon, after I get bored of or reach the limits of Mozilla's SpiderMonkey engine.

As a little light on why people seem unwilling to try out new scripting languages, I can almost certainly say that I have held off trying some because of a couple of reasons. With some languages (NerveBreak included), the version numbers are less than 0.2 - which instantly tells me that the language is far off being completed and is likely to have bugs or missing features. When embedding a language, I want it to work as expected and not spend hours trying to solve minor problems that are from a missing feature or a bug. Another reason I tend to hold off trying some languages is simply the lack of documentation. I want to see working examples of small embedded applications as well as demos that show more of the advanced capabilites of the language. For me, I want to be able to drop it into my game with little or no hassle, which means there needs to be examples and documentation on how to bind classes and data structures. I also need to know how to handle errors, such as how an error is reported (does it throw an exception that needs catching?).

I guess what I'm saying is that I need a language to prove itself in use. I don't care if it's big and popular, but generally if it is there will be more documentation and better community support.

That said, I will try out NerveBreak when i get time - but only in minor projects until I understand it's capabilities.

Keep chugging along at it, it sounds decent so far [smile]
I use Lua, but it's not because I like its syntax.

Lua is very light, well-tested, and has good embedding potential (particularly with the C++ luabind etc).

I also like using coroutines.

Spidermonkey &#106avascript I've looked at - it's pretty good really, but I don't have coroutine support or an easy C++ bindings system (I think there is one which kind-of works, but details are sketchy).

From a language perspective, I'd prefer &#106avascript as it's closer to C++ than the others (Lua and Python certainly). Also we are used to writing embedded &#106avascript in our web pages.<br><br>And I quite like &#106avascript - I think those people who designed it did a good job (ok, so there's a bit of legacy Netscape bloat in there like String.bold() or something)<br><br>Mark
Thank you for your replies :-).

Yea, documentation and support is something very important. I can see that AngelScript includes a lot of code in it's site and the AngelCode forum is a very active forum with 99% of the posts being about AngelScript (from the quick look i've taken yesterday). However -according to it's creator- AS is there for one and a half year, but nobody can say that it's a "famous" library. And there is an active community too.

However that what seems that gives life to a library (and i think that this is true for any kind of library, not just a scripting library) is the community and the amount of projects that uses that library. But if you think about it, you'll see that this behaviour leads to a closed circle: the famous library is used which makes it more famous by the project that uses it, so more developer knows about it and then they decide to use it in their own projects (sometimes without doing any special search for alternatives - if at all) and the circle goes on.

And this is totally understandable and acceptable by the library users.

However, i think that there is something different that other, less known, scripting engines can offer to them: the increased ability to modify and/or define how the language will be. See, for example, the AngelScript forum, which is 2-3 clicks away from here (you can open a new navigator tab or explorer window if you prefer the evil IE way :->). There are many requiests from the users which are implemented at the next releases (WIP or not). Some of the posts even define the way the language it is. In my case with NerveBreak, the same applies too. I have done lots of additions and modifications to the engine and the language, just because i was asked for them, even if these modifications had none or a little impact on my projects for the moment.

I don't think that the same would be done with Lua or Python. I'm not 100% sure about that, i didn't asked their creators, but i believe that just because there is a big userbase, major changes to the language and/or the API are not as easy as when you have to deal with smaller, less known libraries/scripting engines.

What do you think?
--Slashstone - www.slashstone.comNerveBreak free scripting system.
I'll answer your question with a short story :)

A few years ago when the 3d graphics card wars were being waged
3DFX vs. Rendition and eventually vs. ATI, My brother and I were in the market for a video card, a really good video card for games.

We weighed the options, and we smartly thought, hey, lets go with the 'best card'.

We determined best card on best performance in games (raw FPS and looks), good user feedback, and a solid price. We assumed we had made the correct choice. A Canopus Total3d (Rendition Verite).

Time passed (only a few months), and the war was starting to come to an end.
Shortly after our purchase, not a single driver update was released for our card, and the line was discontinued.

Renditions slowly disapeared off the market, and fewer and fewer games supported them, until eventually, all support stopped.
The video card, was an excelent card.


My next video card was a very well supported, common, nvidia geforce DDR 256. To this day is still chunking away (fully supported!) in a computer.

A moral?
Support/following is king.

[edit]
Whoops, posted exacly as you did.
Heh, sorry this didnt fully address your more recent question. :)

ATI heh. my bad.
[/edit]
"1 is equal to 2 for significantly large quantities of 1" - Anonymous
...ATI-manufactured GeForce?

This topic is closed to new replies.

Advertisement