You are viewing archived messages.
Go here to search the history.

Sophie Smithburg 2021-11-15 12:19:45
Kartik Agaram 2021-11-16 16:53:49

I've been getting sucked hard into the Lua universe in recent weeks. Some links.

Introductory magazine article: https://cacm.acm.org/magazines/2018/11/232214-a-look-at-the-design-of-lua/fulltext

Very cool technical paper on how they manage to implement an efficient interpreter and register-based VM in 12k LoC: https://www.lua.org/doc/jucs05.pdf

A very interesting "federated monorepo" approach to a batteries-included Lua distribution: https://luapower.com. In particular check out https://luapower.com/philosophy. I particularly feel like the author and I were separated at birth for this passage:

NO [SUB-]DIRECTORIES

This may be a hard sell but I stand by it. [Sub-]directories are evil. Not so much because of semantics, but because of the tools we use suck at working with them. [No global overview;] instead you have to navigate them.


Scott Anderson 2021-11-17 00:32:02

While you're digging into Lua I suggest you check out other implementations that are open source

Scott Anderson 2021-11-17 00:36:31

https://luau-lang.org/ is Roblox custom Lua VM, it adds improved sand boxing, gradual type support, improved performance, has a linter and typechecker

🔗 Luau

Scott Anderson 2021-11-17 00:37:29

It's been recently open sourced, so I don't have much experience with it, but it's probably roughly analogous to JavaScript:Typescript

Scott Anderson 2021-11-17 00:39:28

https://luajit.org/ is pretty well known so you might be aware of it. The name makes it obvious, but LuaJIT is a version of Lua that does just in time compilation and has some of its own custom features\syntax

Scott Anderson 2021-11-17 00:39:36

it also has a fast interpreter

Scott Anderson 2021-11-17 00:39:50

There are some forks\variations that I'm less familiar with

Scott Anderson 2021-11-17 00:50:44

KoreVM\Havok Script was a proprietary LuaVM that was used in a variety of AAA games (Call of Duty, Fable, Kingdoms of Amalur). I worked with it when I worked on Call of Duty, but because it's proprietary and discontinued there isn't too much information on it. Similar to Luau, it had some support for typing (which we didn't use when I worked on COD) and an optimized interpreter and improved (for the time) debugging tools. Seems like Lua has some pretty good IDEs and debuggers now though.

Scott Anderson 2021-11-17 00:55:35

Pico-8 mostly uses vanilla Lua 5.1, but adds a few new built-in library functions and changes some syntax (notably assignment operators and bitwise operators) comprehensive list across versions is here https://gist.github.com/josefnpat/bfe4aaa5bbb44f572cd0

Kartik Agaram 2021-11-17 01:36:33

Oh, I totally missed that PICO-8 is programmed in a subset of Lua!

William Taysom 2021-11-17 03:26:23

Then you no doubt have read "The Evolution of Lua" https://dl.acm.org/doi/10.1145/1238844.1238846.

Favorite quotes...

Most successful languages are raised rather than designed. ... We include a new feature in Lua only when all three of us agree.

Lua provides mechanism not policy. ... Instead of littering the language with lots of features, we provided ways for users to program the features themselves, in the way they wanted them, and only for those features they needed.

Since its first version Lua has had real users, that is, users others than ourselves, who care not about the language itself but only about how to use it productively.

Lua is best described as a closed-development, open-source project. Lua is not developed in a collaborative way. We accept user suggestions, but never their code verbatim. We always try to do our own implementation.

Konrad Hinsen 2021-11-17 10:59:49

The "design of Lua" article is very nice. I'd love to see more descriptions of languages (and other infrastructure software) at that level.

Also, the specific form of minimalism adopted by Lua looks very interesting. More pragmatic than e.g. Scheme.

What do people use Lua for in real life nowadays? Given the existence of multiple implementations, there are probably different important use cases. Scott Anderson mentioned games. Are there other big application domains?

Scott Anderson 2021-11-17 16:50:20

It's used as configuration for a variety of different software, which is kind of it's original intended use case

Scott Anderson 2021-11-17 16:56:00

Redis uses Lua https://redis.io/commands/eval for example

Konrad Hinsen 2021-11-18 07:13:32

Embedded use cases make a lot of sense, also because there is little competition in that space, with Tcl mostly dead and Python having moved on elsewhere.

But what about the heavier machinery I see, such as LuaJIT or Terra? Terra in particular looks like a replacement for C, so the code structure should be Lua outside and Terra inside, rather than Lua inside something else.

Breck Yunits 2021-11-19 20:25:08

These videos from Primitive (via @John Voorhees ) are amazing! https://www.youtube.com/channel/UCOR_9Zltvwwv623_4msNp8Q Feel like I've gotten a better sense of what the cutting edge of FoC in VR is in just a few minutes.

🎥 Primitive

John Voorhees 2021-11-19 20:39:37

Thanks Breck Yunits - you are welcome to try Primitive with or without a VR headset. We have integrations with bitbucket and GitHub

J. Ryan Stinnett 2021-11-20 16:13:04

Microsoft's spreadsheet-like Power Fx formula language (which was mentioned here back in March https://futureofcoding.slack.com/archives/C5U3SEW6A/p1614709272084400) is now open source: https://powerapps.microsoft.com/en-us/blog/power-fx-open-source-now-available/

Mattia Fregola 2021-11-20 22:57:23

🐦 Amit Pitaru: From the archives Playing on the Sonic Wire Sculptor

[[SOUND ON]]

Tweet Thumbnail