Live data from Hacker News

Why isn't everyone using Lua?

news.ycombinator.com

1–10 of 15 posts

Why isn't everyone using Lua?

#1
I came across the Lua programming language and started reading the first edition of 'Programming in Lua', which is available for free online (http://www.lua.org/pil).

I am incredibly impressed by the conciseness of the language and its syntax and really like it (there are only a handful of types, the 'table' data structure can be used to easily create any complex data structure), it is fast and is designed to be called as a script from c, and c functions can be easily called from it. Intuitively it appeals to me even more than Python does.

Its adoption seems to suggest it is not widely used outside game programming? Why? What is wrong with you people? ;)

Re: Why isn't everyone using Lua?

#2
Personally, I find the syntax horrible. A good few years ago, I wrote reasonably complex stuff in Lua (a game addon, you wouldn't have guessed, right? :P), and it was quite painful to do that.

It doesn't help that it's embedded into larger applications most of the time, which do not allow easy debugging, if at all.

Re: Why isn't everyone using Lua?

#3
post #2

Personally, I find the syntax horrible. A good few years ago, I wrote reasonably complex stuff in Lua (a game addon, you wouldn't have guessed, right? :P), and it was quite painful to do that. It doesn't help that it's embedded into larger applications most of the time, which do not allow easy debugging, if at all.

That's really interesting. Obviously, I've only started reading the docs and have no real-world experience with the language. I hadn't even thought about debugging. Do you know an alternative language that you would prefer to use in that context? Do you think the reason for its popularity in game programming is because there is not really any alternative?

Re: Why isn't everyone using Lua?

#4
i don't see any great advantage that outweighs the cost of switching from python. the language is not that different, but i already know python, my co-workers know python, and python has more libraries and wider support.

i am not criticising lua in any way - from what i know of it, it is exemplary (there's a good paper on its implementation that i enjoyed). but languages don't succeed on intrinsic qualities alone.

Re: Why isn't everyone using Lua?

#5

i don't see any great advantage that outweighs the cost of switching from python. the language is not that different, but i already know python, my co-workers know python, and python has more libraries and wider support. i am not criticising lua in any way - from what i know of it, it is exemplary (there's a good paper on its implementation that i enjoyed). but languages don't succeed on intrinsic qualities alone.

I don't have a lot of experience with Python, is it as easy to call out from and into c code as with Lua? (I am now just guessing as to why a game programmer would choose Lua over Python).

Re: Why isn't everyone using Lua?

#6

i don't see any great advantage that outweighs the cost of switching from python. the language is not that different, but i already know python, my co-workers know python, and python has more libraries and wider support. i am not criticising lua in any way - from what i know of it, it is exemplary (there's a good paper on its implementation that i enjoyed). but languages don't succeed on intrinsic qualities alone.

I don't have a lot of experience with Python, is it as easy to call out from and into c code as with Lua? (I am now just guessing as to why a game programmer would choose Lua over Python).

lua is easier to embed, is smaller, and has better performance. it's also a slightly cleaner language (all other things being equal, i think it is slightly better than python: the handling of tables is more regular; it has better support for continuations; it has tco; and correct scoping). on the downside, the "maps as arrays" approach is a bit clumsy.

Re: Why isn't everyone using Lua?

#7
I've always gotten the impression that Lua has a somewhat anemic standard library and a somewhat limited set of abstractions, in contrast to the things that draw me to Python – is this still accurate? Python, Ruby, etc. have a wide range of built-in functionality, which allows them to stand on their own, whereas Lua seems to be intended for use with C programs and libraries, keeping it in the game/scripting world. Are these assumptions still accurate? (Also, indexing from one is just frustrating when almost everything else is zero-based!)

Re: Why isn't everyone using Lua?

#8

I've always gotten the impression that Lua has a somewhat anemic standard library and a somewhat limited set of abstractions, in contrast to the things that draw me to Python – is this still accurate? Python, Ruby, etc. have a wide range of built-in functionality, which allows them to stand on their own, whereas Lua seems to be intended for use with C programs and libraries, keeping it in the game/scripting world. Ar…

That seems definitely accurate. From my limited experience it certainly seems Lua has the more minimalistic approach, although that must have been a conscious decision on the part of the authors. I like how built-in functions can be 'overriden' (more like replaced) to be made more restrictive to create a sandboxed environment. I agree I can't think of any good reason for the one-based indexing, it seems to be a bit of a gimmick :)

Re: Why isn't everyone using Lua?

#9

I've always gotten the impression that Lua has a somewhat anemic standard library and a somewhat limited set of abstractions, in contrast to the things that draw me to Python – is this still accurate? Python, Ruby, etc. have a wide range of built-in functionality, which allows them to stand on their own, whereas Lua seems to be intended for use with C programs and libraries, keeping it in the game/scripting world. Ar…

[deleted]

Re: Why isn't everyone using Lua?

#10
The Lua community has been historically more focused on embedded and scripting scenarios, and less on building a comprehensive platform for libraries and applications (compare the quality and availability of LuaRocks to PyPI, Ruby Gems, CPAN, etc.). That combined with the almost non-existent standard library means that not only does Lua not give you a solid base of code to build off of, it's hard to find a community-driven one as well. This leads to developers having to play mix-and-match to get a good base running. Also, the "table can be used to emulate any structure" piece means that every library and developer does OO and modules just a little bit differently, harming reuse across code bases.

There are a couple of syntax decisions (default globals, no ++ or --, indexes start at 1) that might cause negative reactions, but I'd put the lack of libraries and frameworks above that.

Lua is still awesome for simplicity, easy C binding, and performance, but deciding to build a new project in Lua requires a significant investment in just getting the base libraries put together.

Post reply on HN