I fell out of love with Lua

Saturday, August 16, 2014

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.

More Rubbish

Your Portfolio Gave Me Diarrhea

Friday, October 1, 2021


Friday, September 24, 2021

We got married

Thursday, September 16, 2021

Unity Quiz

Sunday, September 6, 2020

Everything We Watched In Lockdown

Thursday, September 3, 2020

Rust Screenshots

Tuesday, July 29, 2014


Thursday, July 10, 2014

How I Upload Stuff

Saturday, May 17, 2014

9 reasons why I LOVE C#

Friday, April 18, 2014

Serializing Shit

Thursday, April 10, 2014