Preferences

For me, JS has just too much magic, in particular the behavior of 'this', and lots of weird quirks, like "for in" vs. "for of". Lua, on the contrary, is very predictable and therfore easy to understand.

One killer feature of Lua (that surprisingly few scripting languages have) is stackful coroutines, i.e. you can yield across nested stack frames. Unlike JS or Python, there is no artificial split between generators and async/await and no need for function coloring.

If Lua had zero-based indexing, it would be close to perfect :)


Have you read large Lua codebases written by others? It is write-only language. All your "very predictable" features are overloadable, at runtime. No static typing to rest your eye on. It is a swamp.

"But, just write good code" you will say. Just like with Perl, some languages are designed in a way to discourage writing good code...

I'm talking about the core language, which I do find very predictable. You can go crazy with any language. Lua is definitely not worse than Python or JS in this regard.

> No static typing to rest your eye on.

That goes for any dynamically typed language. How is that an argument against Lua in particular?

> Have you read large Lua codebases written by others?

No, because I use it as a scripting language, as intended. I totally agree that one shouldn't use dynamically typed languages for building large applications. But again, this is not specific to Lua.

Oh, as a scripting language you embed into your project so that you can write scripts for it — there is hardly anything better than Lua. The C code is super clean and easy to embed and modify.

But once that project gets passed to next maintainer — I'm not sure I'd pick Lua over Forth or Scheme.

I would pick Tcl instead, but I am biased. :)
I occasionally have to write Tcl. No thanks :)
I wrote it during four years as main language (1999 - 2003), alongside C.
Yes, I was going to write this comment a few hours ago but never got around to it. Working on other peoples Lua can be very painful.

Even the fact that people really want to write object oriented code, but every project rolls its own class system is a problem.

When I write lua is just tables of data and functions. I try to keep it as simple as possible.

I've been enjoying writing games for the Playdate, and in Love2d.

if Lua had zero-based indexing it won't be Lua. also removing '.length - 1' globally will reduce gas emissions by 1% worldwide (my guess)

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal