5 ms·
Why is it such a great language? As a developer entirely divorced from the gaming industry aside from occasionally dabbling in modding, lua has always seemed co
by 0xffff2 4y ago
Why is it such a great language? As a developer entirely divorced from the gaming industry aside from occasionally dabbling in modding, lua has always seemed completely inscrutable to me when I have encountered it.
- Tyr42 4y agoThe C API is pretty straightforward and has a stack object to avoid lots of reference counting you would need with Python's c API. It's also a tiny codebase which is easy to vendor and ship.
- agentultra 4y agoIts obscenely easy/consistent memory layout. It makes embedding it into another application straight-forward and easy to manage. Extending the host interface to the embedded scripts is very simple because of this. It's also serialize-able to a degree. Python is also a decent glue language but creating a Python interpreter is a bunch more work and the API is a bit harder to work with.
- guipsp 4y agoLuaJIT is insanely good
- elfprince13 4y agoI think the main attractions are that it has pretty minimal syntax + core libraries, does a good job binding to C FFIs, and the interpreter is fast.
- schemescape 4y agoIt’s a tiny but capable language that’s easy to embed, and can be surprisingly fast with LuaJIT.
- kzrdude 4y agoThey have a clean API for embedding. All Lua interpreter state is kept in a struct that you alloc. If you alloc two distinct structs, you have two completely independent Lua vms and you can run them on independent threads if you want to no problem, and so on. (Few language runtimes are clean in this way.)
- cozzyd 4y agoyes, python is basically impossible to embed in a multithreaded app.
- outworlder 4y agoInscrutable? The language is _tiny_ (and kept that way on purpose) Aside from stuff like metatables(which may require you to play around for a bit to understand their value), you can pick it up in a couple of hours. I'm not even kidding. So much so that you see people modifying code without even looking at documentation. https://www.lua.org/manual/5.4/ https://www.lua.org/manual/5.4/ https://learnxinyminutes.com/docs/lua/ https://learnxinyminutes.com/docs/lua/