←back to thread

220 points generichuman | 2 comments | | HN request time: 0s | 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{3}[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 #
1. nmz ◴[] No.44011089{4}[source]
> Lua's syntax is beautifully simple and unambiguous

    local print = print
    ("hello"):format()

    local foo = func
    ("args to func"):itreturnedatable("!")
replies(1): >>44011694 #
2. 90s_dev ◴[] No.44011694[source]
Well of course you can trick people who aren't familiar with its syntax. But people who are see that this is

    local print = print("hello"):format()

    local foo = func("args to func"):itreturnedatable("!")
And I'm sure they can guess that that does.