Most active commenters
  • 90s_dev(5)
  • growlNark(4)

←back to thread

219 points generichuman | 15 comments | | HN request time: 1.383s | source | bottom
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 #
1. growlNark ◴[] No.44001116[source]
Sure, if you compare via semantics Lua and Javascript make sense to liken. But in terms of complexity, Lua is far more like C. There's no unfucking all the horrible decisions baked into javascript and I wouldn't touch it with a ninety-foot pole, but Lua still has some hope.
replies(3): >>44001131 #>>44004578 #>>44006694 #
2. 90s_dev ◴[] No.44001131[source]
Every language has warts. Even Lua.

Like another commenter said, using . instead of : is maybe the most common mistake, too easy to make. And Lua offers no help preventing or checking it.

TypeScript is a great language. So is Lua. So is C.

When used carefully to avoid their warts. Learning how to do that for any language takes time and practice though.

replies(1): >>44001139 #
3. growlNark ◴[] No.44001139[source]
> Every language has warts.

Yea, and then there's javascript (or typescript if you prefer), the C++ of scripting languages. It's sometimes difficult to see any value through the warts. (Unless you're paid to, of course.)

replies(1): >>44001362 #
4. 90s_dev ◴[] No.44001362{3}[source]
Every time someone says this about JavaScript, their favorite language turns out to be something like APL or Ada.
replies(1): >>44005619 #
5. SkiFire13 ◴[] No.44004578[source]
To be fair Lua also made some bad decisions, though maybe not as bad as javascript:

- tables being used for both objects and arrays can create a lot of confusion, especially when you have some integer keys, but not all, and especially when they are not consecutive or one of them is 0 - indexes start at 1 - assigning nil deinitializes variables/entries instead of assigning the value `nil` (this becomes especially bad if you mistakingly try to use nil as a value in an array/table) - nil and false are falsy, but not 0, which instead is truthy

replies(2): >>44006456 #>>44010616 #
6. growlNark ◴[] No.44005619{4}[source]
Having a favorite language is weird (to me). They're tools, and some are more effective and usable than others, and some are better suited to some tasks than others.

But, equivalently, of course I'm going to criticize a hammer if it's literally covered in warts making it difficult to grasp without slipping. (or, if the gun I'm trying to use keeps firing bullets into my foot when I'm aiming down range.)

7. growlNark ◴[] No.44006456[source]
No disagreement here; I also fundamentally question the cardinal indexing and conflation between table and array. But it's at least internally consistent and certainly makes more sense than mandatorily indexing arrays with floating point.
8. xigoi ◴[] No.44006694[source]
You’re using C as an example of a language that is easy to understand?
replies(1): >>44007512 #
9. spookie ◴[] No.44007512[source]
C is indeed simple.
replies(2): >>44007981 #>>44009611 #
10. Rochus ◴[] No.44007981{3}[source]
Until you reach the many dark corners of the syntax.
replies(1): >>44009049 #
11. DaSHacka ◴[] No.44009049{4}[source]
simply don't do that
replies(1): >>44009435 #
12. Rochus ◴[] No.44009435{5}[source]
Unfortunately it's unavoidable for real-world systems.
13. xigoi ◴[] No.44009611{3}[source]
The C standard has about 700 pages.
14. ufo ◴[] No.44010616[source]
Tables being dual purpose is fine. The real problem is that assigning nil deletes the table field. Unfortunately, fixing that now would cause Python3 levels of breakage.
replies(1): >>44011698 #
15. 90s_dev ◴[] No.44011698{3}[source]
I've never had an issue with =nil being delete. What problem does it cause?