Hacker News new | past | comments | ask | show | jobs | submit login

Meh. I don't get the love Lua gets on HN. At least version 5.1, I didn't try the others.

No first class support for OOP, you got to use tables instead.

No "continue" keyword to go to the next iteration of a loop. So you have to use some ugly elseif.

No try catch!

It's a dynamic language so everything goes. A function will return nil or a number or whatever you wish. A function can also returns any number of variables, so obviously some moron will abuse it: looking at you Blizzard intern (you must have been an intern right?) that thought returning 20 variables on the combat event log was a good idea. Ever heard of tables???

The LSP can't do miracles when there are almost no rules so auto-completion is more miss than hit, which is quite shocking in 2024. The IA is helpful sometimes but create subtle bugs some other times. A simple uncaught typo will create a hard to find bug (yesterday copilot auto-completed myObject.Id instead of myObject.id, there went 20 minutes of my life trying to find why some code that was running solidly for weeks was now failing silently).

So all in all, Lua is fine to write small imperative scripts of a few hundred loc. Anything bigger and more complex you should run away IMHO.

I never realized C# was such a well designed language until I tried Lua.






I agree. Also tables are quite weird, and 1-based indexing is definitely a mistake (sorry 1 fans but it is).

I think it just doesn't have much competition in the "embeddable languages" space unfortunately.

As another commenter said, JavaScript is probably the best choice in most cases today.

There's a list of options here but most of them are not really good options usually:

https://github.com/dbohdan/embedded-scripting-languages

E.g. Python would be a terrible choice in most cases. Awk? Some of them aren't even general purpose programming languages like Dhall.

If you narrow it down to embeddable-like-Lua there are hardly any.


> No first class support for OOP, you got to use tables instead.

You get meta tables instead which allow you to trivially write an OOP system that perfectly fits your needs. Yes there is more than class-based OOP.

And I mean trivially: https://lua-users.org/wiki/SimpleLuaClasses

For some people not being locked into one form of OOP or any OOP at all is a huge advantage.

> No "continue" keyword to go to the next iteration of a loop. So you have to use some ugly elseif.

Yeah, that sucks. Thankfully Luau fixes that and basically all annoyances I have with Lua. https://luau.org/syntax

> I never realized C# was such a well designed language until I tried Lua.

Lua and C# have fundamentally different design goals. C# sucks for embedding, you have to include a huge runtime. Godot still hasn't figured out how to support C# on web builds. Lua values minimalism and flexibility. That obviously means it lacks some quality of life features of bigger general purpose languages.

Language design is about trade offs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: