News for hackers. Stuff that matters.
Re:Using Lua as a Serialization Format by scruple on Wednesday June 17, 2020 @10:40PM (#23559266)
I used Lua as a data exchange format for some embedded devices (software defined radios) because it played nicely with the C code and the Lua scripts we would run on the device (which served as a sort of interface bridge between hardware device drivers). The Lua binary can be compiled down to < 100kB and the language itself is fast enough for a scripting language to have been useful in this context (I don't know if that still holds today, I left embedded in 2014).

It was a really pleasant experience but we were not working with a very large number of tables. I miss Lua all of the time, too, and play around with it whenever the opportunity arises. It holds a really special place in my programmer heart, alongside lisp, C, and Ruby, for having shown me some really interesting things at the right time in my career. It's too bad it doesn't have more widespread adoption, I think a lot of people could benefit from using it for the things it's good at.

Re:Using Lua as a Serialization Format by rstupek on Wednesday June 17, 2020 @11:05PM (#23559393)
There are a number of places it's being used today. There's an nginx module with an entire web front end development environment (openresty), Cloudflare uses the nginx lua module heavily, you can develop cross platorm (ios, android, web) games in Solar2D.
Re:Using Lua as a Serialization Format by duskwuff on Thursday June 18, 2020 @03:36AM (#23560705)
The NodeMCU[1] environment for ESP8266/ESP32 microcontrollers is pretty neat too -- it targets a $2 microcontroller with wireless network access (and Bluetooth in ESP32), with builtin functions to make HTTP requests and interact with external devices.

[1]: https://www.nodemcu.com/

Re:Using Lua as a Serialization Format by scruple on Wednesday June 17, 2020 @11:17PM (#23559455)
I'm aware, but I've never seen a shop I've consulted for or any of my employers use it. I've tried to get it in use a few times and ultimately it went no where because I would be the only programmer in a department with > 100 FTEs who would be able to work on it or maintain it unless some others took the time to learn it. It's been a non-starter as a result.

When I ask around, I don't hear about it in use locally (edit: that's actually not entirely true, Blizzard uses it and maybe some of the other local game shops, but I don't see it anywhere else locally). I met someone at a conference a year or two back who was using Kong. That's been it. Maybe I'm just missing it but I don't really see widespread use.

Re:Using Lua as a Serialization Format by vvanders on Wednesday June 17, 2020 @11:44PM (#23559609)
It never really saw adoption outside of games from what I've seen.

Its such a simple but powerful language, has one of the best interop apis with C and I love how they approached coroutines.

It's really a shame it doesn't see wider use. We used it to ship all our game logic on the PSP, 400kb prealloc block and it worked like a charm.

Re:Using Lua as a Serialization Format by zwirbl on Thursday June 18, 2020 @02:06AM (#23560228)
It's used in CHDK, the Canon custom Firmware Project for user definable scripts https://chdk.fandom.com/wiki/CHDK Besides this I've rarely encountered Lua in the wild

Edit: And of course in Magic Lantern, for Canon EOS DSLRs https://magiclantern.fm/

Re:Using Lua as a Serialization Format by dividuum on Thursday June 18, 2020 @10:26AM (#23563386)
I built a digital signage solution for the Raspberry Pi based on Lua (https://info-beamer.com) which turned into a company. API documentation is on https://info-beamer.com/doc/info-beamer, while most source code for what's running on the screens can be found on https://github.com/info-beamer/. Couldn't have done it without Lua.
Re:Using Lua as a Serialization Format by zimpenfish on Thursday June 18, 2020 @10:33AM (#23563448)
Kong[1] is basically a bunch of Lua scripts on top of OpenResty.

Redis[2] lets you write internal scripts in Lua.

Edit: Forgot Torch[3] which is great for generating nonsense with RNNs.

I think it's definitely getting more of a foothold in the world outside of games.

[1] https://konghq.com [2] https://redis.io/commands/eval [3] http://torch.ch

Re:Using Lua as a Serialization Format by lactobacillis on Thursday June 18, 2020 @03:18AM (#23560600)
The are a few lua lapis users out there: https://leafo.net/lapis/
Re:Using Lua as a Serialization Format by jddj on Thursday June 18, 2020 @06:57AM (#23561875)
I'd used lua in my early teens to script some games and ended up receiving money for my efforts, so I put it on my resume coming out of university.

It turned out that one of the first companies (embedded, automation) I interviewed with used it for integration between various third party subsystems. I think those conversations helped me feel like less of an imposter at the time.

I never use it anymore, but the language is nice. I wonder what web development world we'd live in now if they'd embedded lua instead of creating JavaScript.

Re:Using Lua as a Serialization Format by adwn on Thursday June 18, 2020 @03:12AM (#23560570)
> It's too bad it doesn't have more widespread adoption, I think a lot of people could benefit from using it for the things it's good at.

I think that's because there aren't many things it's really good at. It excells at a niche – as a light-weight, easily embeddable scripting language – but is mediocre as a general-purpose programming language, because it's standard library is extremely spartan and lacks so many things you need on a day-to-day basis.

Re:Using Lua as a Serialization Format by jmiskovic on Thursday June 18, 2020 @03:51AM (#23560794)
I disagree, there are many things it is great at.

The language is well designed, with orthogonal features that complement each other. Coroutines and meta-tables are easy to understand and still powerful way to organize and control code base.

You can actually learn it in a week, and hold all of the language in your head. A very valuable thing in my opinion. The code is very readable to beginners (unlike Perl, Haskell or APL).

The interpreter is incredibly fast. Even non-JIT implementation is surprisingly fast.

The LuaJIT FFI is so convenient that the difference between C/C++ libraries and Lua libraries almost disappear.

There are cross-platform hosting frameworks that allow you to write and execute dynamic interpreted code on otherwise locked down platforms (Android, Switch, TVs...).

I would say Lua lacks tooling and better organization of community. Biggest Lua communities were built around products that embed Lua like WoW, Roblox, Corona (now Solar2D).

Re:Using Lua as a Serialization Format by spc476 on Thursday June 18, 2020 @05:35AM (#23561421)
I use Lua at work to process incoming SIP messages (using LPEG [1]). It's handling million of calls per day without issue.

[1] Lua Parsing Expression Grammar http://www.inf.puc-rio.br/~roberto/lpeg/