3 ms·
Lua is a great language, simple enough to start with and do something with. Lightweight and fast. I love using Lua even though I hate having to reinvent every l
by PenguinCoder 4y ago
Lua is a great language, simple enough to start with and do something with. Lightweight and fast. I love using Lua even though I hate having to reinvent every library worth of functions I constantly want to use elsewhere. Lua rocks is okay but I don't really like using it. Lua has a Simple syntax, easy to grasp but hard to master and achieve complexity with.
- gyulai 4y agoI suppose the more lua-esque thing to do is to not use lua in isolation and not rely on lua rocks, but instead embed it in some host language, and then rely on the host language to do the heavylifting where libraries and ecosystem are concerned. For example, if you're scripting and need to deal with yaml files, then instead of using a yaml parser from lua rocks, you might embed lua in python through lupa and then expose PyYAML through lupa to your lua code. This sounds limiting, but it's actually liberating. Depending on what it is you're actually doing, you can just pick the host language and the libraries you want to use in a way that best integrates with the things you need to integrate with.
- maccard 4y ago> then instead of using a yaml parser from lua rocks, you might embed lua in python through lupa and then expose PyYAML through lupa to your lua code. Well this might take the cake for the most bizarre suggestion I read online this weekend. If someone on my team genuinely suggested embedding an interpreted language inside another interpreted language that we have embedded in a static language, just to load config files, I would genuinely think they're totally out of touch.
- gyulai 4y ago"Please respond to the strongest plausible interpretation of what someone says, not a weaker one that's easier to criticize." [1] Embedding python in something else was not part of my suggestion, rather I suggested using python in cases like scripting, where python would already be a good choice of an ecosystem. Also YAML-parsing was merely an example, and I wasn't necessarily envisioning that parsing a config file was the only actual purpose it would serve. The fact is that no piece of code ever exists in a vacuum. It's always part of some application ecosystem, e.g. Windows GUI programming in C#, apache spark based ETL development in Java, scientific computation in Python, etc. ...most applications have an ecosystem (language+libraries) that's a clear "winner" in terms of adoption and richness of functionality for the given application. My suggestion is merely this: Just go with the flow, pick the winning ecosystem, then embed lua and write your own stuff in lua while exposing whatever bits of ecosystem you need to integrate with to lua through some minimal logic that exists on the host language side. If you context-switch at any point in the future, that gives you a good chance of being able to reuse your lua code. For example say you've developed some highly specialized piece of math for a scientific data crunching project in Python. Now you want to use that math in a GUI. Just embed lua in a host environment that's good for GUI development. ...chances are you'll be able to reuse that Lua code. If you had written the math library in Python to begin with, you're now in the difficult situation of being forced to use Python for GUI development, embedding Python in something that's good for GUI development, rewriting your code, all of which are pretty bad options and Lua might be a lesser evil. [1] https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- samatman 4y agoI've found a lot of useful Lua code out there, but it's a very different ecosystem. I need some function(s) in python, I'm browsing pip and bringing in whatever looks like it has stars in recent activity. Lua? I'm looking for a Lua file, usually in a git repo (or a gist, oddly enough), and vendoring it with a link to the original and license. The 'funny' part, if you will, is they're often 8 years old with like three commits total and less than a dozen stars. You would think that would make it buggy, but that hasn't been my experience. It's just that Lua shows up in so many different contexts, with all the idiosyncrasies. The majority of Lua users don't care about luarocks, so when they want to share some code, they don't necessarily bother with a rockspec. Just a very different culture. What JavaScript is to the browser, Lua is to anything you want: and this is a large difference, JS's relationship to the browser is much more intimate. The Lua interpreter is best viewed as almost a demonstration program, sure, you can write software with it, but this is the degenerate case of embedding the interpreter in just enough host program to run it.