Which language should you use?

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

Previous topic - Next topic

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.


JavaScript
Let's start with JavaScript. 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 (especially in web development), 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
Squirrel is barely known outside of GTA multiplayer mods (and even within 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
Lua is the language I'm least adept with, so this answer might be a little bias. You'll find no shortage of Lua scripters around GTA multiplayer modifications. On top of that, there are many useful resources in Lua from other GTA MP mods like FiveM and MTA SA. Lua's operators are generally more oriented around words instead of symbols, so sometimes it can look 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. If you're coming from MTA:SA or FiveM (or plan to use them now or in the future alongside GTA Connected), this might be the language for you.

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.