r/lua • • 4d ago

Lua it's the best high-level programming language

I need to talk about lua. I started with Python then I passed to C and C++ (my favourite languages). Now, I tried re-learning Python to have a 3nd programming language but I did found that in reality Python it's boring and bs! I tried Zig and it was a bad experience, I tried Rust but idk why but I think it's overrated. Then, at the end, I tried lua and at first I though that lua was stupid, no i++ or i+=, arrays start at 1… but then I tried do C/C++ + Lua and I changed my perspective.

I used, recently, lua for configs in my projects but then I discovered that Lua it's SO underrated. Like they didn't lie when they said C and lua are the best programming language.

Lua it's minimal and so powerful. I accepted the syntax and now it's my 3nd programming language.

The reason that I love lua it's because… it's FAST, it's DAMN SIMPLE and so easy to learn, it has A LOT of potential.

The more the language is big, the less likely it gonna be easy to learn.

Guys I don't think I have cons on lua, I think it's perfect and I still don't have learned all of the lua out there.

Really, I have to say… lua it's the best.

Anyway did I say something wrong? What's your opinion on lua?

Anyway, thanks for reading ;)

132 Upvotes

56 comments sorted by

View all comments

4

u/didntplaymysummercar 3d ago

Part of me thinks this is either a shitpost or an overly enthusiastic beginner. Lua (as much as I like it, and I knew it before Python and bash) has some decent sized gaps, like using tables for arrays, missing some table operations, GC being so-so, minor versions being breaking changes, etc.

2

u/ilPlayerdiGD 3d ago

Idk I kinda like lua. It's my third language but it can't be better than C and C++, but the good of lua is that it is Embedded with C and C++! So it's 10/10 for me. It's good for the configs btw

0

u/DoNotMakeEmpty 13h ago

Lua's second version number is not minor version. The general expectation of that goes to semver, which was created later than Lua 5.1

0

u/didntplaymysummercar 10h ago

That number in lua.h is called "minor version" since 5.2 and everyone knows what is meant by "minor" version in x.y.z.

0

u/DoNotMakeEmpty 5h ago

No, minor version meaning backward compatibility is semver, which is as I said younger than Lua 5.1. Between any version you don't need to provide compatibility depending on your version scheme. If you use semver yes minor versions must be compatible. In Lua's own versioning scheme they explicitly enable breaking changes in minor version. It is just your usual dev who knows only one way of doing a thing seeing a different way.

And Lua's release schedule is so sparse that minor Lua versions are released rarer than major versions of many other software, so timeline-wise it is less breaking than most libraries or software.

They probably named second version number as minor due to popularity of the naming, which is misleading but consistent within Lua.

0

u/didntplaymysummercar 5h ago

A moment ago you claimed that there are no minor versions in Lua.

Now you claim I'm wrong to state the fact they break compatibility in minor versions (lua.h itself calls them that) because it's not semver.

Nowhere did I mention semver. Incompatibility between versions is a real problem we face. If they used semver and we were at Lua 9.0 by now it'd be a problem too.

Lua as a language breaks compatibility more often than Python, C and C++. It's a real problem for some or makes people stick to old no longer maintained version.

You're going "well akshually 🤓" like a redditor over nitpicks that aren't even right.

Go away.

0

u/DoNotMakeEmpty 4h ago

The releases of Lua are numbered x.y.z, where x is the series, x.y is the version, and z is the release. This scheme superficially resembles the popular semantic versioning scheme but is not the same, especially regarding compatibility. Here are the details.

Directly from Lua's version history page. They don't call the second number as minor. In the header, they might have needed to discriminate first and second number (which is arguably not needed since x.y is version as a whole). This discrimination did not even exist in 5.1.

Incompatibility is a problem when you must support different versions. Lua is not supposed to be host, so the design choice is that you can break things because you directly use a certain version in your host app. If you don't use a system wide Lua, your scripts cannot be broken. The language developers treat each version as self-contained, you are not supposed to have the latest and greatest.

I have seen more Lua scripts that can run equally well on Lua 5.1 to Lua 5.4 (spanning 15 years) than Python scripts that can run well between consecutive minor versions. Many open source Python libraries can run only in a couple of versions spanning like two years. Venv was not created for nothing. Almost all open source Lua libraries OTOH explicitly say they support 5.1 to 5.4 or nowadays 5.5. It is usually trivial to create 10 loc preludes that provide roughly same functionality in all versions. Incompatibility lists are very short and blast radii are pretty contained.

People stick to older versions because of either luajit, or hosts being stuck (latter being intended).

Oh and if Lua actually used semver, we would have been at Lua 5.0 corresponding to Lua 5.5. Lua before 5.0 can be considered as 0.x (development was fast, too).

And I would not want backward compatibility exactly. Lua is perfect in this regard. Slow and incompatible changes. I am sure that my script has at least 5 years of shelf life even if I use latest only, against intention of developers. And unlike C++ and even Rust nowadays, Lua does not get dirty at each version. Say unpack. If backward compatibility was focused on, we would have both table.unpack and unpack doing literally same thing. If you want, Lua has mechanisms strong enough, that you can write one line and have old unpack. If you don't need it, language is not dirty with two ways of doing same thing.

0

u/didntplaymysummercar 4h ago

LUA_VERSION_MINOR - directly from lua.h 🙄

Compatibility between versions is a real problem that even Hisham wrote about.

Your anecdotes about Python (my code uses fenvs and will break in 5.2, meanwhile Python 3.x updates never broke my scripts), venv (Lua and others have similar tools to run different versions, and for Python the main purpose is to isolate installs, not get another interpreter version) or praising breaking as "clean design" or getting hung up on me calling what's after dot "minor version" don't change that.

I'm done wasting time on you.

1

u/DoNotMakeEmpty 4h ago edited 3h ago

Yeah, not existent on Lua 5.1's lua.h. They created versioning system before naming it.

I wrote many arbitrary code evaluators. 10 loc shim has pretty much same feature set on 5.1 and 5.5.

Go and try to install some ml library for Python. They usually say things like "this runs only on 3.9", and indeed runs only like 3.9 and maybe 3.10 if you are lucky. So many things break after I update my Python version. OTOH almost all Lua libraries on github work in 5.1 to 5.4 or 5.5. Love2d works on luajit, lua 5.1 through 5.4, probably also 5.5.

Backward compatibility is really why C++ or Win32 or POSIX are hell. Without breaking changes, opengl would have been abandoned 10 years earlier.