Which language should you use?

Started by Vortrex, November 17, 2019, 12:01:06 AM

Previous topic - Next topic
November 17, 2019, 12:01:06 AM Last Edit: April 08, 2022, 12:21:21 PM by Vortrex
I've been asked this question several times in the discord so I decided to just write a topic to save time having to re-explain it. Plus nobody likes walls of text and it's a lot cleaner on the forum.

So I'll start by saying that if you have experience with any of the three scripting languages supported by GTAC (JavaScript, Lua, and Squirrel), then the easy answer is to use that. Familiarity is best and you'll probably be more productive with a language you already know. If you don't have any scripting experience, or never tried any of those three languages, continue reading.

Let's start with JavaScript. JavaScript is my favorite of the three. It has a massive "community" behind it, and usually within the top languages on sites where you can get help or find resources (Stack Overflow, GitHub, etc). JavaScript is everywhere now, handling both back and front end operations, which is a far cry from it's origins as a way to run simple client-side operations within a web page. For future programming aspirations outside of GTA Connected, this is the language to use. JavaScript resources also start and execute faster than the other two languages on GTA Connected.

Sounds too good to be true right? You bet it is. Despite all the advantages, there are some cons to using it. It's the most complex of the three, and it's quirks make it a poor starter language to learn. JS used to be a big mess but gradually becoming more refined thanks to standards like ECMAScript.

Squirrel is barely known outside of GTA multiplayer mods (and even <I>within</I> them) and a couple other tiny projects. However, I find Squirrel's syntax to be the easiest, but I'm already fluent with it and have been for many years. It has a simple table-oriented structure and basically grabs many of the good parts from other languages. Squirrel was used on a couple other GTA multiplayer mods, like Liberty Unleashed and IV-MP, although both are now defunct. VC-MP is the only active mod that supports Squirrel, and you can find many resources there.

The only issue is that very little documentation exists for it and can make the learning curve a bit more complex. This can be alleviated a bit, thanks to many similarities to JavaScript, which has documentation everywhere. If you're not already using another language and don't plan on doing any scripting outside of GTA Connected, then I definitely recommend Squirrel.

Lua is the language I'm least adept with, and although I know it fairly well and have experience scripting on other mods with it, I don't really like using it. There are others who prefer Lua and you'll find no shortage of Lua scripters that can be found around GTA multiplayer modifications. On top of that, there are many useful resources in Lua from other GTA mods like FiveM and MTA SA. Lua's operators are generally more oriented around words instead of symbols, so in a sense it looks more like something you'd read/write rather than code. If you need help, Mex is our local Lua guru here at GTA Connected, bringing his ample experience from MTA:SA, VCO, and SOL-O (VCO and SOL-O both long gone) and his VLE resource is still the most advanced and sophisticated that I've ever seen in my many years within various GTA multiplayers.

But like the other languages it's not without it's shortcomings. It's not widely supported around the web and not many other projects have support for it. The syntax of Lua is the least similar to the others that GTA Connected provides, which makes converting or borrowing code from them (or vice verse) generally difficult and slow.

I hope you found this information useful.