That is a nice euphemism. The lack of something even remotely resembling a standard library is what keeps me from using lua more than I absolutely have to.
Because more complex constructs can be created so easily in Lua everybody is happily copy/pasting half baked stuff from the web. That means there is no common style which might make it consistent across code bases so Lua remains a "Bring Your Own" language. No proper arrays, no easy exceptions, no easily recognizable classes ("but it is so easy with setmetatable etc."), iterators, prettyprint...
Plus the various annoyances, such as nil access not being an error, no += (I read all the reasons against it), weird "false" concept, that tables are - if you look closely - neither arrays nor dictionaries, the "require" imports are not modules but more akin #include.
In my opinion Lua 6 should drop some historic weirdness (~=!) and make the core language more in line with JS or Python and provide a standard library - even if components there sacrifice some of the holy performance.
You can write a parser that makes Lua js-like (or even better) in a couple of hours, but that woudn’t make it popular. Including it into a browser would though. But browsers still resist to include anything viable like RxRS scheme-likes at least that could be transpilation target, repeating that unsmart ‘maintaining complexity’ argument. You’re stuck with js and that’s why rants go all the way. If it had enough concepts, there would be less rants and more transpilers, but it is dumb af and oriented on end-developers rather than on library, system or metadevelopers. At least wasm is a hope, but it was not seen seriously yet in this regard.
Ps. require() is a regular one-time module-load routine, nothing to do with #include.
I've embedded both and used them heavily in my various window managers, and these days I personally recommend embedding JavaScript over Lua if possible.
But when a small, portable and lightweight language is needed, there's also Sparkling[1], which is like the best ideas of JavaScript with the minimal footprint and portability of Lua.
Having spent a lot of time looking pretty hard at Lua, LuaJIT, and embeddedable variants of JS(duktape and the like) I think that's a bit of a stretch.
It's pretty trivial to induce JS memory leaks[1] that can be brutal on embedded platforms. We had a prototype project written in JS and Lua, same functionality but hit issues like this pretty often. Like most memory leaks they weren't straightforward to track down as well.
For my money LuaJIT still reigns supreme despite the fact that it's not under active development any more[2].
[1] http://point.davidglasser.net/2013/06/27/surprising-javascri...
[2] https://www.freelists.org/post/luajit/Looking-for-new-LuaJIT...
All these "Let's do Lua, but right" languages fill me with both hope AND dread. This also shows what Lua could have become if a few more bold decisions were made. But I guess without a large commercial entity behind it, that was inevitable.
Is there list of lua-ish (especially wrt. speed and easy C integration) languages somewhere? I did not know this one for example.
[1]: http://squirrel-lang.org/
[2]: http://wiki.squirrel-lang.org/mainsite/Wiki/default.aspx/Squ...
What do you mean by ‘almost’? You cannot have fair separate threads of execution or substitute function’s global environment in javascript, but this is the other way ‘almost’. What features does js have beyond syntactic sugar and second-hand techniques?
(edit: sorry this is regarding iOS)
I’ve ended up doing a lot of JS with React Native for “app-y” mobile apps though.
https://luadigest.immortalin.com
Difficult for Lua to reach the same momentum as other languages since it's mostly embedded but every bit helps.
I can find games, window managers, embedded devices, and a bunch of other stuff that can be scripted with Lua, but there doesn't seem to be anything like a Visual Basic equivalent that lets you layout a GUI graphically and tie the controls and events together with Lua, at least not for native applications. Why is that? It seems like it'd be a good fit.
For Lua, it's use as a mainstream application development language is still in it's early stages. The language follows the mantra of move fast and break things so backwards compatibility isn't a top priority and this can be an issue in evergreen codebases like web apps (unless you are willing to lock to a specific version). Most web servers (most famously OpenResty, a Lua NGINX hybrid) are still on 5.1 due to LuaJIT.
Basically, my interest in Lua is this: I'd like to build a personal computing environment that is oriented towards end-user empowerment the way I remember them being in the pre-web era. To that end, employing a relatively simple interpreted language to build as much of the environment as possible is desired such that the end user is able to read and modify large portions of it, as well as create their own tools. Something on the level of Visual Basic or HyperCard would be useful for the GUI portions, and Lua is popular enough to have a lot of learning resources available, so it was an option I was considering.
There have been quite a few attempts at building OSes with Lua as main system/userland language. There are very few Lua implementations that can bootstrap so you still need a bit of non-Lua code as glue for the interpreter bits if not for juggling pointers.
You can reach me at Luadigest at <my username> .com
These features are in almost any language nowadays, including most of languages that AOT-compile to native code. Well, maybe without multiple returned values, with tuples instead, but this is the same thing, especially if there's some primitive destructuring support.
Type coercion for comparison is quite rare too, even js has `===`.
But no standard library at all, so everyone brings his own incompatible hacks (by copy-pasting snippets) and processes lists (hashes emulating lists because there are no real lists) with `for` loop. Even with `for` loop it's not that obvious how to loop over list.
I tried writing in Lua and can't stand it at all, even JS feels much nicer. Lua is minimalism for sake of minimalism, and it heavily hampers practicality. Easily embeddable? Who cares if embedded runtime is 100 Kb or 2000 Kb?
Well, it might be a good language if comparing it to Basic from 80s home computers, so it's used in PICO-8.
We ran Lua on the PSP with 8MB of system memory inside a pre-allocated block of 400kb. Did the whole game logic and state management with no hiccups(and this was before LuaJIT).
Not everything is desktop scale, lots of applications in spaces like routers, wearables and other constrained devices.
I've also seen few langauges handle coroutines and clean and simple as Lua does them.
That's a joke, right?
This is a positive point to me. I love python but hate pip and stuff.
Things like virtualenv solve the problem of having multiple versions of the same package or interpreter in different projects. Rpm and apt can't do that, that's why developers are using package managers for virtually every language. Furthermore creating native packages for even the major distros and LTS releases is too difficult. There are also tools like asdf that handle multiple languages (and databases!)
Docker solves the problem of distributing the application. Virtualenv is quite weak about that. Docker can also be used to create separate environments on the development machine and install packages without virtualenv. We still need pip because nobody creates native packages. The same reasoning applies to every language I'm working with (Ruby, Node, Elixir, PHP.)
This is simply not correct: the truth is that people are lazy and don't want to spend the required time reading the documentation, the first thing a real engineer does. Instead, they just want instant gratification. They just want to hack. OS packaging is actually quite easy.
"We still need pip because nobody creates native packages."
I created over 170 CRAN R packages as RPM's. Was it time consuming? You bet! But now it's done correctly. Now it's done cleanly. Now I don't need nonsense like Docker, and I could even plug them all directly into Kickstart and have Kickstart spit out ready to serve systems with a rich R environment on them. With no scripting or any code. Just because I made RPM's, the client now has an architecturaly simple application ecosystem. Simple is robust.
If not, do you keep the RPMs updated and did you ask the authors to create RPMs instead? What did they answer you?
Yes, I maintain the RPM's. It's easy because I always build .src.rpm's (SRPM's) by default, and a binary .rpm (RPM) ends up being a product of one of the steps in that process (`rpmbuild --clean -ba ...`).
But all of that is almost irrelevant. The relevant bit is that if done correctly, if done cleanly, as operating system packages, organizations need neither Docker nor "infrastructure as code" (copious amounts of amateurishly written glue in a scripting language) and the software is easy and fast to install and maintain -- for both system administrators and end users. I even do very large scale configuration management with operating system packaging, rather than with applications like CFengine, Chef, or Puppet.
Higher order functions, coroutines, the ability to return multiple values from a function, no coercion on comparison operators make coding in Lua a breeze.
You can learn most of the language within a day.
Ofc not everything is perfect: The package ecosystem is growing but still small compared to other languages. Anonymous function definitions are pretty noisy.
Still I think it's one of the best designed languages you can find.