7 ms·
Really can't understant why Lua isn't more used. It play the same role as Ruby, Python and JS and is very fast, at least, much more then Ruby and Python.
by diegobernardes 9y ago
Really can't understant why Lua isn't more used. It play the same role as Ruby, Python and JS and is very fast, at least, much more then Ruby and Python.
- spc476 9y agoBatteries are not included in Lua. To do most anything interesting requires third party libraries (like directory manipulations, network, etc).
- corysama 9y agoYep. Lua's small (and removable) standard library makes it really great for embedding, not so great standalone.
- mmjaa 9y agoBut when you need batteries, you just install luarocks and move on with it.
- veli_joza 9y agoIt's not that libraries are not available, it's that they are not _standard_. Python has much healthier and more coherent community partially because everybody started out with same carefully chosen building blocks. With Lua you either build your own or bring in dependencies from libs and frameworks. Regardless, I'm enjoying Lua more and more and it's becoming my go-to language for prototyping and exploring concepts. The code just flows more naturally than in other languages.
- mmjaa 9y agoI think there is something else to this. Most highly productive Lua applications I've seen, been involved in, &etc., are bound to system-level libs/api's, etc. So the thing about Lua as a scripting language like Python, is that you can use it like that. But the major power of the language is when you apply it by glom'ing it into some bundle of C/C++ libraries that are, indeed, BYO-batteries... Like, Lua is bring-your-own battery, true. For everything else, there's Penlight/luarocks, though.
- Pxtl 9y agoNot just that, but Lua is very conservative about adding new language features so a lot of quality of life things are missing - no ternary operator, verbose lambda syntax, the incoherent mixing of arrays and dictionaries, bad default scoping, stuff like that.
- spc476 9y agoIf you are willing to fork Lua (and it's been done---one example is Ravi, which brings static typing) you can fix the verbose lambda syntax (http://lua-users.org/lists/lua-l/2017-04/msg00387.html http://lua-users.org/lists/lua-l/2017-04/msg00387.html) and add ternary operators (which I haven't missed). I haven't found the mixing of arrays and dictionaries that bad in practice (and I do a lot of Lua programming at work) and the default scoping ... yeah, I can see that (I've learned to deal).
- stevekemp 9y agoI had a fork a long time ago solely to allow the use of "?" in function-names. Writing: function alive? ... blah end Is so much more natural, after being exposed to ruby. But maintaining forks is hard, so I've slowly gotten use to the standard. It's a shame that the development is so conservative, and closed, but despite that it is a great language to play with.
- jpfr 9y agoA function that tests for something involving its arguments is called a predicate and usually ends in p or -p. http://www.cliki.net/Naming+conventions http://www.cliki.net/Naming+conventions
- mmjaa 9y ago>"incoherent mixing of arrays and dictionaries" Incoherent? 10 years of Lua development, never had a problem with it. In fact, the ability to use a table as either an array or a dictionary is one of the great features of the language. Most newbie Lua coders get over the differences pretty fast. For everyone else, there is lua-enumerable.lua ... https://github.com/mikelovesrobots/lua-enumerable https://github.com/mikelovesrobots/lua-enumerable
- ice109 9y agoand how good is the ecosystem? honest question
- veli_joza 9y agoIt's much smaller community than Ruby or Rust... People are very friendly and most of learning content is freely accessible. Most of us use LuaJIT (at least on desktops) but many are worried about its future, as lead genius has stepped off and few other people can understand the internals of LuaJIT. There's a very nice "package manager" for downloading and installing modules, called LuaRocks. On the other hand, lack of tooling is a big issue. ZeroBrane seems to be only decent IDE with debugging support. There's ton of stuff in libraries and Lua extensions, you just have to be careful about what you are integrating. You might for example end up with two incompatible implementations of class system from two different libs.
- mtw 9y agoIsn't it the same in many other languages? For a Ruby project, you usually have to use a dozen gems to get started. For a javascript project, it's at least two dozens of npm packages
- abecedarius 9y agoI've written a few programs in both Lua and Python, and the Lua is generally almost twice as long. Lua tends more forgiving of mistakes which I'd rather be errors, like a missing table key. So though it's great in some ways, it's not my first choice to get something done with.