๐Ÿ“ฆ about ๐Ÿงป posts

I used to like Lua a lot and now I don’t. I think anyone intending to add a scripting language to their game/engine should seriously consider using Javascript instead.

This opinion isn’t based on anything logical like speed or implementation. Lua has served us really well in Garry’s Mod in terms of both speed and speed of implementation. It’s worked pretty much flawlessly.


My real issue with Lua is the syntax. It’s different for the sake of being different. A claim is always made that the language is made to be easy to understand. There’s a lot of places where this falls to bits. Want to add two strings together?

mystring = front + back;

No, that’s too hard to understand right? Lets do this instead.

mystring = front .. back;

Why is that easier for people to learn? Why are // comments harder to understand than — comments?

How do we test if something is not equal to something? Which one of these makes the most sense?

one ~= two
one != two

The ! isn’t used anywhere else on Lua, so there’s no real reason for them to use ~ other than to be contrary.

Bad Habits

By using Lua you’re teaching a bunch of people the wrong way to program. You’re teaching them a language that isn’t going to help them in the future. You’re teaching them that arrays start at 1 not 0.

Missing Features

Lua doesn’t have unicode support. This is a pretty big deal in a modern day scripting language, you shouldn’t have to treat strings like binary data and you shouldn’t have to install addons to support unicode.

No “var++” or “var += blah”. The whole point of scripting languages is to make it easier to code.

No continue keyword.

Javascript is the future

Javascript is used all over the web. It’s only going to end up getting used more and more. Google, Mozilla and Microsoft are all working to make it faster and faster.

Ultimately if we have to teach people a scripting language, lets teach them a language that will serve them in the future. Sure the jump from Lua to Javascript isn’t that great, but if you skip Lua there’s no need to make a jump at all.

Update: 25/5/2018

Javascript sucks, c# is the future.


Add a Comment

An error has occurred. This application may no longer respond until reloaded. Reload ๐Ÿ—™