Live data from Hacker News

Lua beats MicroPython for embedded devs

embedded.com

11–20 of 87 posts

Re: Lua beats MicroPython for embedded devs

#11
post #7

> [bolded] Lua isn’t just a high-level language. It’s an embedded dev strategy. I find it difficult to take any writing seriously when it uses phrases like this.

The whole article gives me a 'I know LUA and have been using it for years, I also tried MicroPython for a couple of hours, so now I'm ready to draw conclusions' vibe. With some 'Python vs C' on top of it. Not everything written about MicroPython is factually incorrect, but some of the things are so over the top to the point that it becomes ridiculous. Just one example:

MicroPython can be equally readable, but in practice, many projects end up with blurred layers between system code and scripting. That creates a maintenance burden as projects grow.

Yeah, right. Even if this is the case (I find it hard to belive the author has really seen 'many' sort of professional MicroPython projects), where's the proof the language used was the deciding factor in that. And not the project management for instance. Or simply the dev's architecturing abilities.

Re: Lua beats MicroPython for embedded devs

#12
With respect that sounds like marketing fluff.

You use micrpython when you have lots of horsepower and need something fairly robust on the network.

You use C/C++ if you need precise control over power, memory or CPU. Even though if you're doing network stuff its much harder to do quickly and securely. (THere might be better embedded TLS support now)

Lua is frankly just sparkling C. Sure if someone has create a bunch of libraries for you, then great, if not, you've now go to support lua toolchain, and your own microcontrollers toolchain, and port what ever control lib the manufacturer provides yourself.

Or, as this is a marketing page, pay https://realtimelogic.com/products/xedge/ to do it for you.

Re: Lua beats MicroPython for embedded devs

#13

With respect that sounds like marketing fluff. You use micrpython when you have lots of horsepower and need something fairly robust on the network. You use C/C++ if you need precise control over power, memory or CPU. Even though if you're doing network stuff its much harder to do quickly and securely. (THere might be better embedded TLS support now) Lua is frankly just sparkling C. Sure if someone has create a bunch…

> You use micrpython when you have lots of horsepower

It runs on a 2350.

Re: Lua beats MicroPython for embedded devs

#14
post #4

What’s the dev experience actually like for serious Lua? I’ve only used it for some basic neovim configuration. The dynamicism and lack of type hinting in Python that was the norm when I started having to review professional code, after transitioning from pure mathematics, was a major cognitive blocker for me. With a math paper I could typically skim the first few pages to map the author’s particular symbology (if no…

Lua can be quite an elegant language once you get to know it well, but you can still use it like most other programming languages, it's not that weird. There are quirks like arrays starting at 1 (and all arrays being hash tables) but they don't take that long to get used to. The real strength is in the ecosystem and implementation itself, it's designed to be easily embedded into applications and there's not really much else like it. Some developers want to incorporate a scripting language into their project and get turned off by Lua's quirks and choose something else, but it usually ends up causing more problems than it was meant to solve.

On typing, there's only a few main ones you need to worry about—strings, functions, tables and numbers. I don't think it does weird things like JS where it converts between them without asking. Luau adds some type hinting if it's a big point of concern but I haven't really looked into it much.

Re: Lua beats MicroPython for embedded devs

#15
post #5

When I decided to create a game engine where the game could be entirely scripted in a scripting language, I was choosing between JavaScript (QuickJS), Python (Boost.Python), and Lua (Sol2). The ease of embedding Lua, even with a C++ wrapper, is incredible. With little effort, I now have something I consider “ready”. Not to mention, it’s a very lightweight VM. https://github.com/willtobyte/carimbo

Boost.python is not the best scripting tool to be honest. So, that might affect your judgement as well.

Re: Lua beats MicroPython for embedded devs

#16

is anyone "serious" using micropython or lua for embedded work?

I have been developing Lua-heavy embedded products as a freelancer for about 20 years now, including VoIP devices, home automation controllers, industrial routers, digital video recorders, and more. These systems typically consist of a Linux kernel, some libc implementation, the lua interpreter and a few 3d party libs support libs to help building the app. The Lua apps ranges from 30k to 100k lines of code, depending on the application. Some of these devices can be considered 'small' in 2025 terms: 8MB of flash, 64MB of ram. Lua is doing great here.

All of these products are still alive today, actively supported and making my customers good money.

Some things come very natural to Lua: Lua C interfacing is a breeze, and while some modern languages are still struggling to figure out how to do proper async, Lua has been able to do this for decades. The language itself is minimal and simple but surprisingly powerful - a few smart constructs like coroutines, closures and metatables allow for a lot of different paradigms.

For new projects at this scale, I would still choose Lua + C/C++ as my stack. Over the last few years I have been visiting other ecosystems to see what I'm missing out on (Elixir, Rust, Nim), and while I learned to love all of those, I found none of them as powerful, low-friction and flexible as Lua.

Re: Lua beats MicroPython for embedded devs

#17
post #4

What’s the dev experience actually like for serious Lua? I’ve only used it for some basic neovim configuration. The dynamicism and lack of type hinting in Python that was the norm when I started having to review professional code, after transitioning from pure mathematics, was a major cognitive blocker for me. With a math paper I could typically skim the first few pages to map the author’s particular symbology (if no…

Lua can be quite an elegant language once you get to know it well, but you can still use it like most other programming languages, it's not that weird. There are quirks like arrays starting at 1 (and all arrays being hash tables) but they don't take that long to get used to. The real strength is in the ecosystem and implementation itself, it's designed to be easily embedded into applications and there's not really mu…

> There are quirks like arrays starting at 1

I know it’s probably and overreaction, but this was a compete non-starter for me.

Re: Lua beats MicroPython for embedded devs

#19
post #4

What’s the dev experience actually like for serious Lua? I’ve only used it for some basic neovim configuration. The dynamicism and lack of type hinting in Python that was the norm when I started having to review professional code, after transitioning from pure mathematics, was a major cognitive blocker for me. With a math paper I could typically skim the first few pages to map the author’s particular symbology (if no…

There are languages that transpile to Lua that get you things like typing…

https://typescripttolua.github.io/

I’m personally a fan of YueScript which is basically an evolution of MoonScript (but it’s not typed).

https://yuescript.org/

LuaJIT has ridiculously easy C interop.

Re: Lua beats MicroPython for embedded devs

#20
post #5

When I decided to create a game engine where the game could be entirely scripted in a scripting language, I was choosing between JavaScript (QuickJS), Python (Boost.Python), and Lua (Sol2). The ease of embedding Lua, even with a C++ wrapper, is incredible. With little effort, I now have something I consider “ready”. Not to mention, it’s a very lightweight VM. https://github.com/willtobyte/carimbo

Is Sol2 a Lua VM or just a wrapper to the standard Lua VM?
Post reply on HN