打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
scripting

Why has Python been backed by google and become so rapidly popular and Lua has not?

Do you know why Lua has stayed in background?

asked Apr 8 '11 at 21:52
Ubiquité
1,0311413

25  
Yes. I do know why Lua is stuck in the background. It's a secret conspiracy. But I can't say more, or they'll kill me. –  S.Lott Apr 8 '11 at 21:55
3  
@S.Lott: You've said too much already! –  Steve Evers Apr 11 '11 at 13:14

 
Lua likes to pretend arrays and dictionaries are the same thing, and has a length getter that can not only return wrong results, but nondeterministic results. I don't know what Googles reasons are, but this is enough reason for me to dislike it. –  Steve314 Aug 8 '11 at 7:47
add comment

closed as primarily opinion-based by MichaelT, GlenH7, gnat, Kilian Foth, World Engineer? Oct 29 '13 at 13:16

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers

up vote 4 down vote accepted

I really love Lua, but it does have some real limitations, and as others have mentioned they derive mostly from Lua's origins as a configuration file language and then later as an embedded scripting language.

Because of the goal to keep Lua small, there exists only a very tiny standard library, that has only bare bones functionality.

This has lead to an unfortunate culture in Lua circles where Lua developers like to re-implement the functionality offered by many other language's standard libraries themselves rather than working collectively on a universally accepted set of core libraries.

Things like multi-threading, regular expressions, platform independent file access methods, and even bit operations (until 5.2) ere all "not included" since they would make Lua much larger and slower. Sure you can get libraries do so these things - but then those have independent maintainers and quality levels.

Don't get me wrong. I love Lua for the same reasons I have just listed.

answered Aug 8 '11 at 7:32
sylvanaar
1,071217

add comment

Simple : Lua have more "niche" objectives than Python.

Python is thought to be useful as a general programming language. So, it's useful in a lot of cases. It covers many well known types of application but doesn't enter directly into competition with other languages that might be targeted at specific constraints, but the simplicity of it's syntax.

Lua is totally targeted to be an embedded scripting language. It's initial purpose, even if it's used in other contexts currently, like build systems; is to be embedded in software and to allow easy implementation of domain-specific script functions and structures. It's so minimalist that it can even be used on really constrained hardware (I used Lua on NintendoDS), it's lightweight, easy to use, FAST, and is such a minimalist language but thought to be extended that a lot of dialect (importing paradigms like object-orientation) are available. It's so portable (ANSI C) that you can use it on any embedded hardware with decent amount of memory for modern embedded software (if I remember well the default lua vm is around 400ko and will almost never grow if you don't loop creating objects...).

So, Lua is initially used in context where you need to embed a scripting language for your application.

Python is used for...almost anything that doesn't require a more niche language (you can make quite performant games using Python, but some kind of performance-heavy games really require to avoid such system).

It's simply that Python is used in more contexts than Lua. As far as I know, other than Android (that provide Java and native language support), Google isn't an embedded software company so they don't really need Lua everywhere, while Python is useful for anything they do (web, build system, communication, web and web).

Python is used in a lot of games for embedded scripting too, but it's heavy and slower than Lua. The syntax of Python makes it more appropriate for big games that rely a lot on scripted information in their game structure (not sure I'm clear there but just think that if you need a "real complete language" for scripting, embedding Python might be a good idea, if the performance is fine for you).Python was not made to be embedded, so that's fine. An equivalent of Python that is targeted at being embedded in C++ is Falcon.

For extreme comparison, some languages that target embedding and try to have more complete syntax than the minimalist Lua, and compete on performance : ChaiScript, AngelScript, Io...

By the way, I've seen new build systems like PreMake or Bam use Lua as the build file language. The idea is that it's lightweight and well known from game developers (build systems in game developpement is a major problem).So maybe that's another domain where Lua might be more appreciated. It's certainly more user-friendly than CMake syntax....

answered Apr 8 '11 at 22:10
Klaim
9,9062247

3  
I think Lua's target as an embedded language is probably a major contributor. But even still, I believe "popularity" of a language has less to with the actual design or capability of the language itself and more a matter of "right time, right place" (see PHP, for example). –  Dean Harding Apr 8 '11 at 22:38

 
Well I think that a language targetted at specific purpose naturally appeal to specific users, making it's audience more restraint than any general-purpose language. Having a less audiance than general-purpose languages directly impact the number of people that will ever talk about it. Other than that, specific targets means specific features. Therefore, it's not good for every situation. Here for example lua alone is not a very good gui-programming language. It requires some additions to be really useful. –  Klaim Apr 8 '11 at 22:43

 
That said, I fully agree: if php wasn't used for such a widely used field as web-site developpement, it wouldn't be everywhere now. –  Klaim Apr 8 '11 at 22:48

 
Lua is mainly used as embedded language but it is a general purpose programming language, for instance you can make CGI script with mod_lua. I could change my question to why lua stayed as an embedded language? –  Ubiquité Apr 8 '11 at 23:01

 
Because it's it's origin. You can use it as a general purpose language yes, as you can use php too for general purpose. You can also use Perl to do the same. But their origins makes their orientations. Again, their initial purpose makes them less useful than other languages for general purpose languages. Lua lack some feature language to be easy to use with GUI system for examples, like object orientation (that you can add easily, but it's not native).Make sure you see the difference between a language originally made for specific purpose and a general one. They all have constraints anyway. –  Klaim Apr 10 '11 at 11:35
add comment

You can do everything with Lua, it's created as a scripting language to extend programs? Yes, but it's far from limited to it, there is a lot of libraries for Lua, and with the right tools(LuaJIT's FFI or tolua) you can even use a C/C++ Library on it. The reason that makes Python more used in my point of view are only age, Python is used as first languages in many colleges and schools, there is more people that know Python than Lua, and is much more easy to found a good library for Python than for Lua, because the language is more mature. Also, i don't know much about Python, but as much as i know, it's easy to hide your code from the end-user, what in Lua, isn't that easy, i'm right?

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
List of game engines
嵌入式Lua相关文章索引
Five Worlds
python电子资源
法语学习资料
我该使用何种语言 [转][美]John Hattan
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服