Main Menu

Which language should you use?

Started by Vortrex, Feb 15, 2023, 07:56 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Vortrex

(Originally posted on GTA Connected forum)

So I'll start by saying that if you have experience with any of the three scripting languages supported by MafiaC (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 Mafia 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 Mafia/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 is used on GTA Connected and VC-MP and was previously used on a couple GTA multiplayer mods, like Liberty Unleashed and IV-MP, although both are now defunct.

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 Mafia 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 Mafia 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 some GTA multiplayer mods like MTA:SA or FiveM (or plan to use them now or in the future alongside Mafia 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 Mafia Connected provides, which makes converting or borrowing code from them (or vice verse) generally difficult and slow.



I hope you found this information useful.