4 ms·
Lua gets used on more embedded systems than you might expect, since it's small, fast, and doesn't need floats. You turn the garbage collector off, tune the all
by samatman 4y ago
Lua gets used on more embedded systems than you might expect, since it's small, fast, and doesn't need floats.
You turn the garbage collector off, tune the allowed step size, and trigger collection in steps when it's allowed. Having the Lua VM and GC around is not the hard part of getting hard real time guarantees out of such a system.
With Lua, those parts get written in C for the most part. With Common Lisp it's possible to use one language for both parts. At least as I'm told, by those who should know, I've not tried writing any CL which wasn't comfortably high level.
- outworlder 4y agoLua is one of those amazing technologies that one wonders why it isn't just about everywhere. Complex configuration files, embedded scripts, even browser scripting should all have been done in Lua. (Or Lisp, but people have less of a visceral reaction when they see Lua syntax) Theoretically some Common Lisp implementations could have GC disabled. Like you, I have not tried that in practice.
- Karrot_Kream 4y agoIn my experience, Lua is everywhere, for some definition of everywhere :P I see it all over the place in so many different settings, embedded, high level scripting, gaming, etc etc
- pdimitar 4y agoI agree and I already used Lua successfully for scripting. My gripe with it is: no easy parallelism and I don't mean OS threads. I suppose it's not a priority for them, sadly.
- melony 4y agoWdym Lua has no floats? Lua defaults to doubles (big floats) not integers.
- LeifCarrotson 4y agoAs of Lua 5.3 (from 2015), Lua has both doubles and integers. The famous book "Programming in Lua", still often used and quoted, did apply to 5.2, which had only doubles.
- samatman 4y agoWorth adding that the only 5.1 anyone still uses (not you Warcraft), LuaJIT, has native support for C numeric types, including complex numbers. They can be referenced literally as 12LL, you can do arithmetic on them, but have to call `tonumber` to use them where Lua expects a 'number'.
- samatman 4y agoWhat I said is that Lua doesn't need floats. You can build Lua on a 32 bit chip which doesn't have a native float type, without floating point support. Which is handy.