←back to thread

218 points generichuman | 2 comments | | HN request time: 0.619s | source
Show context
90s_dev ◴[] No.44000882[source]
I'm so relieved to see more types being added to good languages.

So Teal is to Lua as TypeScript is to JavaScript. Which means it automatically plays well with any Lua environment. Unlike luau and nelua which are also statically typed but have their own runtimes.

What version of Lua does it use? Lua gets new versions every few years so I don't know why so many impls don't continuously upgrade to the latest version.

replies(5): >>44000888 #>>44000949 #>>44001419 #>>44004694 #>>44005269 #
RS-232 ◴[] No.44000949[source]
Lua is a good language. It's like C, if C were a scripting language.

It's got an awesome C API. It's fast, lightweight, and embeddable. It's more performant than Python. It's a staple in video game scripting.

replies(2): >>44001017 #>>44001045 #
90s_dev ◴[] No.44001017[source]
It's nothing like C, and that's so much of its charm.

Semantically, Lua is almost identical to the core of JavaScript. Metatables are a genius alternative to prototype chains.

Lua's syntax is beautifully simple and unambiguous, but at the cost of being moderately inconvenient in 2025 unfortunately. It could benefit from an ESNext-style renewal.

I get why they made the C API that way, but in practice it's very easy to get wrong.

I'm not sure how fast vanilla Lua is today compared to similar languages. I think LuaJIT (and Luau?) are most often used when performance is needed.

replies(3): >>44001116 #>>44001427 #>>44011089 #
isr ◴[] No.44001427[source]
FYI, for those who may not be aware, moonscript is the "coffeescript" for lua. It has been in production use for quite a while (the author of moonscript also created itch.io, using ... moonscript).

yuescript, from the dora-ssr game engine dev, is essentially moonscript-2.0

And of course, if you want to treat lua as the scheme-like it really is (deep down), then ... fennel.

Lots of choices. They all compile to straightforward lua, are very easy to incorporate (you can even compile at runtime, if you wish), and all employ full lua semantics, meaning zero runtime overhead

EDIT: and the curse of not reading fully ahead strikes again (doh!). Someone else has made the same points below ...

replies(1): >>44002314 #
1. 3036e4 ◴[] No.44002314[source]
If Teal is the TypeScript of Lua, Fennel is the ClojureScript. Except Fennel is fully implemented in Lua itself and it transpiles (usually) to very simple, plain Lua code without much (if any) overhead and with no run-time library other than what is in Lua itself.

https://fennel-lang.org/

replies(1): >>44006708 #
2. xigoi ◴[] No.44006708[source]
The JavaScript equivalent of Fennel is Sibilant: https://sibilant.org/