5 ms·
Through the years starting from around 1998 I deployed Lua into several embedded systems: hardware debugging tools, scientific instruments, medical devices, hom
by pjbk 5y ago
Through the years starting from around 1998 I deployed Lua into several embedded systems: hardware debugging tools, scientific instruments, medical devices, home automation and finally robotics. Back then you couldn't beat the small footprint of the environment and the decent availability of libraries so you didn't need to start everything from scratch. In contrast, for example the Pawn language was also competent for similar applications but its ecosystem was quite lacking.
Some years ago when Squirrel started to get traction, particularly due to its adoption in a couple of IoT frameworks, I fiddled with it for some months and it almost got its way into a commercial electronics project. However by then uPython was getting more popular, had better tooling support and ARM microcontroller chips had become very fast. Being able to reuse the same code on the host with minimal or no changes, or having an interface or emulation layer that you can also program in Python is a game changer. It took me less than a week to rewrite the Squirrel code to Python, with even better features thanks to the language facilities.
I thought I was never going to touch Lua again but a couple of months ago I found myself hacking some REAPER audio processing scripts, and cursing Ierusalimschy once more for his decision on neglecting Dijkstra's advice and not starting indexes from zero...
- rstuart4133 5y agoLua is optimised for interpreter size, Python for "language niceness / flexibility", and it shows. Lua has lots of nits, such as the index starts at 1 thing, or the "all numbers are floats" thing. I also find its class mechanism ugly, but the most annoying one for me is it suffers from the totally unnecessary "a variable is global by default" bug. However, life is full of unexpected surprises. While Lua small engine size was a deliberate strategy to make it cheap to embed, it also meant it's much easier to optimise than something the size of Python. And ... that's what happened, so LuaJit is the fastest interpreted language - even faster than the best javascript engines when I last looked. That despite javascript engines having had man decades of optimisation effort put into them.
- portaltonowhere 5y agoFWIW, Lua 5.3 (released in 2015) introduced integers. But agree with the rest.
- int_19h 5y agoIndices starting at 1 in Lua is a deliberate design decision, though.