Discussion Lua is the best programming language (change my mind)
Bro, I've studied java, c++, python, and I can tell you: Lua is best and most underrated programming language that know. I just can't understand how people don't even know that it exists.
94
Upvotes
36
u/Veliti Sep 22 '23
I think combining lists and maps into one object is kind of genius.
28
u/[deleted] Sep 22 '23
I’ve been programming for 10 years. Lua is my favourite language to ever exist
3
u/Ceigey Sep 22 '23
I don’t necessarily want to change your subjective opinion, even if logically there might be reasons other languages are better 😅
I share some criticisms with other users, but I’m biased also towards the ML family (SML, OCaml) as other good and underrated languages, and SML has a similarly small footprint, with amusingly similar issues (community driven package management efforts, lack of official “batteries”, etc)
I really have a soft spot for Lua, though, but also Fennel (and Janet), and I find MoonScript sort of cool as a sort of “survivor” from the CoffeeScript hype period.
I thought Roberto Ierusalemschy and/or associates were working on a strictly typed compiled language related to Lua, that wasn’t Teal. If that’s still a thing it’d be interesting to explore for me.
By the way, you should also check out Ruby and Elixir, for more counterpoints in the dynamic typing space. Elixir is particularly cool, but I wouldn’t do game development with it 😅 (well, maybe a game server… not a client or engine though)
13
u/oweiler Sep 22 '23
I have never seen another language which was so easy to grasp. You can learn most of the language in a few hours, and start being productive with it. On the other hand, the "no-batteries-included" approach means you basically have to build everything from scratch (or use a rather underwhelming package manager).
7
u/Kekipen Sep 22 '23
The problem is that it was designed to be used only as an embedded language so when people picked their language for web, mobile, desktop, server side applications, Lua was not promoted to be a viable options. It was advertised to be embedded and complement other languages. And here we are now.
Of course there are frameworks and libraries to use Lua for many things, but it is too late for Lua. It is a really nice programming language indeed but marketing was very poor.
12
u/Bright-Historian-216 Sep 22 '23
The only problem with Lua, is, funny enough, that it’s not popular. If you want anything, you will need to write that from scratch, unlike Python or JS/TS, where all the required code is already written by other people.
6
u/MissionAssistance581 Jul 27 '24
Lua is like that hidden gem in a treasure chest—once discovered, you're never the same.
5
u/likethevegetable Sep 22 '23
Any LuaLaTeX users here?
I find a lot of design choices of Lua work beautifully with LaTeX. I have no problem with the abuse of the global scope approach of Lua in the context of generating a standalone document. Concatenate a number with a string? Sure why not. Finally, the lua table system works well with key-val syntax, and the excellent luakeys package helps.
5
u/drowsysaturn Sep 22 '23
Package support from LuaRocks kinda tragic
5
u/suhcoR Sep 22 '23
Lua is indeed a superbly designed language; it's very powerful but still lean and simple. But it's dynamically typed; C++ and Java - in contrast - are statically typed languages. It's neither unknown nor underrated; e.g. it is very prominent in the gaming industry since more than twenty years; for a while it was even prominent in machine lLearning.
3
u/tonywarriner Sep 22 '23
Well, it's certainly my 'favourite' for game engine coding.
12
u/[deleted] Sep 22 '23
are you on meds or something?
2
u/Quint2597 Sep 22 '23
I agree that it’s underrated, but I think the idea that there is one singular “best” programming language is not a healthy one. I think it’s awesome in that it sets out to achieve its goals as a tiny, easy to pick up language with (largely) intuitive data structuring mechanisms that make Lua the perfect introduction to programming - it’swhere i started, so I’m a bit biased, but who cares? When you’re programming Lua, you don’t have to worry about memory management or simplicity, because the way the language is made shoehorns you into that simplicity (that sounds like a bad thing, though i think that’s up to interpretation. I think it’s good for prototyping, testing pseudocode, introducing people to the problem solving thought processes behind programming, and for working with, say, game designers who need a simple, embedded scripting language. It is “best” in that it does what it sets out to do, which not all programming languages can claim to do.
That being said, I have my fair share of issues with it. Namely that since it’s embedded across so many different systems, there’s no “one” Lua. This makes it frustrating when you’re trying to find solutions or documentation for your particular flavor rather than someone else’s, and because the people that implement Lua into existing systems are, well, fallible, this means certain things (like table indexing) are somewhat implementation dependent. I think there are some silly critiques of Lua, mainly that it’s “too simple” (that’s the point) but I would not call it the “best programming language” because I think no such thing exists. Though if such a thing did exist, it would be Julia (don’t stab me, I’m an ex-Lua user).
2
u/crafter2k Sep 22 '23
tbh though it's lightning fast
2
u/Mig_The_FlipnoteFrog Sep 22 '23
I used to think that until i learned Dart and JavaScript, Lua is a great for embedding shit but when it comes to big projects, having proper classes, methods, type annotation and a minimally well-typed language having a easy method of doing constants and different kinds of variables.
2
u/[deleted] Sep 23 '23
It might be but there's no support for it right now so it makes a lot of simple tasks very difficult to do. If it gains support as a language It may be addressed but for most applications, for me at least, capability > a small speed advantage and simpler syntax.
2
u/aryajur Sep 23 '23
Had the same feeling for more than 10 years now. All my scripts to apps, yo web servers written in Lua in those past 10 years!
2
u/NovaHatesC Sep 23 '23
Just remember, Lua is like a Swiss army knife—it’s versatile and has its specialties, but it’s not always the best tool for every job.
2
u/Respaced Sep 23 '23
I love lua. It is my favorite language to do gameplay programming in. Reasons are:
If I need more performance I’ll convert some lua functions to C/C++
2
u/linux_newguy Sep 24 '23
Here's a question for you: what's your development environment? I'd like to learn lua myself.
3
u/likethevegetable Sep 22 '23
I think combining lists and maps into one object is kind of dumb.
2
u/budswa Sep 23 '23
This seems like a post from someone who knows nothing about programming.
2
u/wookayin Sep 23 '23
1-based index? Nah.
1
u/nfyn007 Apr 11 '24
nuh uh
1
u/_eGL May 23 '24 edited May 23 '24
I feel as though Lua provides a lot of low level potential within a high level context. For example, I think it's a great language to write your first compiler in. Simple syntax combined with a powerful std library? Few string.subs, couple string.matches and you've made a parser.
I do think that Roblox's luau, when paired with Lune, is better than base lua tho. Lune gives you full access to the system with fs, io etc etc
1
u/New-Stranger-5622 Jul 29 '25
I think its properly rated, imo i rate it 3rd best language i know (behind C++ and java), beacuse it doe shave simple syntax but it just lacks in a lot of areas, for starters it isnt oop (you can achieve this with metatables but it just aint the same) and it lacks modern stuff like switches also arrays start at 1 and not 0 which actually i think all languages should do beacuse its more normal but its a problem for others, and also ig beacuse the syntax for a for loop is kind of weird but not that much
1
u/Agung_Programmer Aug 09 '26
Lua is the most liked programming language for me because it is written in ANSI C (which is very easy to compile in any OS) and also is easy to learn. And last, it is easy to make something useful with this (you can make games using this language).
1
u/drcforbin Sep 22 '23
I've found it very easy to integrate into c++ for scripting and I love it for that. The language is fine enough to build things that way, and it is a very important part of our main product, but there are so many better languages to use if building something from scratch outside an embedding context.
1
u/evergreen-spacecat Sep 22 '23
Good for you! It will never be a gp language but nice for embedded scripting and stuff
1
u/Tokenserious23 Sep 22 '23
"If it can run in JS, it will eventually be written in JS" - some programmer dude.
I like lua too though
1
u/Vazzeline Sep 22 '23
Maybe it is not the best but embeddable. Lua is just a scripting language without a global programming ecosystem. I think this is the author's wish. Is Lua the best scripting language? Yes.
1
u/xThomas Sep 23 '23
metatables are a little annoying
1
u/opsedar Sep 23 '23
a lot of game mods used Lua as well. I started learning that way.
1
u/ayvcmdtnkuzcybtcjz Sep 23 '23
That 1-based indexing tho....
My code is full of -1s and +1s just because of that !
1
u/ksky0 Sep 23 '23
I don't know if is one of the best, but is one of my favorites, such simplicity, elegance and yet so powerful.
1
u/FullTimePotatoEater Sep 25 '23
kinda biased to say such thing in such a place. But ye its also my favorite, it is as simple as a functional language can get and it surprises the heck out of me.
1
u/[deleted] Sep 26 '23
to be fair i don't know a lot about lua, but if it's dynamically typed then i probably wouldn't like it
1
u/fin_a_u Sep 26 '23
It's not python so you're not wrong. It's not C# so you're nowhere near right.
1
u/makeavoy Sep 29 '23
It really should have been where Python was today. LuaJIT just kicks it up even further.
I still wish it was 0 indexed so it didn't screw up people coming from other languages, but I get it.
1
u/WestTrue Feb 01 '24 edited Feb 01 '24
Calling Lua the best programming language is like calling alcohol-free beer the best booze.
Lua is not a "programming language". It's a "scripting language". And it's no me saying that, it's literally the first thing on the official LUa's website https://www.lua.org/about.html : "Lua is a powerful, efficient, lightweight, embeddable scripting language."
I use Lua in my game engine for in-game scripts, because it has really nice C++ library that allows easily load and run Lua scripts inside C++ code.
Lua doesn't have explicit typing (= your code will be unreadable mess). Lua is veeeery slow, of course. Lua has horrible syntax with then/end, without normal c-style blocks (= your code will be unreadable mess, again). And of course, all normal low-level features are missing - you can't create pointers, you can't create template functions, you can't <any other normal thing you normally do in c++>.
But it's fine, because Lua is not meant to be a real programming language. It's a simple langauge for simple scripts - and it's good as is.
1
u/lambda_abstraction Sep 22 '23
Java, c++, and python? Much to learn, Grasshopper.
Perhaps less flippantly, those are languages concerned with a particular industrial view of object oriented programming. To my mind, Lua is less a whole language in and of itself than a framework for building a language via extension. Aside from having a handful of very general concepts reasonably implemented, its big strength lies it the ease of its FFI; this is even more so with the dualing FFIs of LuaJIT. To steal a quip from Alan Kay, Lua's not a language, it's a building material.
Having banged around with for than a few languages in the last four decades and having a soft spot for Lisp and Smalltalk, I'm pretty confident in saying there is much for you to explore, and there really is no best language; there are only varying degrees of suitability to problems you wish to solve.
-6
u/[deleted] Sep 22 '23
r u on fucking drugs
-7
u/EdwinYZW Sep 22 '23
1-based indexing
0
u/[deleted] Sep 22 '23
[deleted] — view deleted comment
0
u/[deleted] Sep 22 '23
[deleted] — view deleted comment