Marcosha_

[Scripting] Changing the programming language.

Recommended Posts

Hello everybody!
I want to offer you a new language for writing scripts for MTA: SA. By the tags in the topic, you've already seen that it's Puthon 3. Many will say that Python 3 is bad for scripting, but it's not! It is similar to lua but has a wider OOP, and has the ability to connect modules. In the Internet very little material on lua, it is available but only in English, and what to do to the Russian community? The Russian segment in the MTA is very large, and lua materials are very small. Of course, the small amount of materials on the Internet for lua is not the reason for switching to Python 3. I understand that I will have to rewrite all functions from scratch, but this can prolong the life of the MTA. Python 3 is not one language that can be used as scripting under MTA: SA, there is also a wonderful language JavaScript v5. Many multiplayer use it as a language for writing scripts.

This is just my opinion. I just suggested that the idea is not bad. :D

Decide for you, dear multiplayer developers.9_9

Oh, sorry for my bad English!

  • Like 4

Share this post


Link to post

Lua - very simple language. That information on russian language, which available, is enough. And even better to just learn English.

  • Like 1

Share this post


Link to post

I like the idea I would learn a new programming language via MTA. :P

  • Like 1

Share this post


Link to post
On 7/16/2017 at 09:38, Gourmet. said:

LUA is good and I am sure it's never gonna be changed. 

Lua it's for kids, We want machine language :twisted:

Share this post


Link to post
20 hours ago, </Mr.Tn6eL> said:

Lua it's for kids, We want machine language :twisted:

xDDDDDDDDDDDD ,

what about java ?? 

Share this post


Link to post

I think it's a little late to completely rework the language now lmao

Edited by Skully

Share this post


Link to post
On 7/20/2017 at 04:52, </Mr.Tn6eL> said:

java it's not programming language just :~!

That's why it is the most searched programming language on the market I guess. Can I see your degree please? You pro.

Share this post


Link to post
On 7/21/2017 at 10:22, xeon17 said:

That's why it is the most searched programming language on the market I guess. Can I see your degree please? You pro.

Java is the most programming language because networking and android apps, In my opinion it's ugly but easy and famous and have great support

On 7/21/2017 at 10:22, xeon17 said:

Can I see your degree please? You pro.

I'm 18 and amateur programmer :D

Share this post


Link to post
On 7/21/2017 at 09:22, xeon17 said:

That's why it is the most searched programming language on the market I guess. Can I see your degree please? You pro.

 Java being real, it's a programming language that shouldn't be used in today tech, It's performance it's far away from C's one, it's resource management is almost nil because it must take away all your computer to work in a regular way. C is the real deal.

PD: Python would be a great scripting addon.

Share this post


Link to post

I think it's pointless to discuss this, it's been brought up many times before and LUA is powerful enough for something like MTA.

It's far too heavily implemented to change it into another language, would take a bigger development team to take it all apart and swap languages and can bring a long time of instability and alpha testing. You guys forget it's more complicated than just swapping the lua lib/dependencies, MTA was designed with using LUA in mind so much of the codebase was made reliant on it, by integrating LUA-specific stuff as deep as in the MTA core. It's practically impossible to revert all of that..

Also it's clear you guys who are discussing in this topic don't have a development spirit (in broader meaning) because if you understood development is 60% planning/researching and 40% coding itself, you'd realise its technically impossible to change the scripting language at this point in MTA development, it's too late. Ofcourse nothing is impossible as you've seen with other big integrations in the past, but as LUA suffices in most needs for MTA (you always have languages believed to be better such as what you suggest here, but as I said before, LUA is a powerful enough lang for MTA) so this versus the big operation/manpower needed to swap languages simply isn't worth it. Other languages don't offer much that LUA for our purposes cannot achieve, so nothing can justify the big codebase overhaul this would be.

 

To conclude what I just wrote, topics like this, are just like topics asking if MTA:V will ever get released, discussions that keep getting launched over and over. So this will be locked.

  • Like 4
  • Thanks 1

Share this post


Link to post

While I agree with everything Dutchman101 said, I'd like to add a few aspects from the technical point of view.

The requirements that need to be fulfilled by the language are very strict, to mention some:

  • Embeddable into other languages (especially C++)
  • Sandboxed (no unsafe functions e.g. such that can invoke system commands)
  • Well-known, stable and mature enough

When thinking a bit about these requirements, there are only a handful of languages left that fulfill all of them.

So let's take a closer look at the suggested languages:

  • Java: Embedding works (even if it's not designed for that), but not sandboxed
  • Python: Designed almost equally for embedding and running standalone, but no official/stable sandbox support (available solutions are rather experimental)
  • C#: Microsoft's official implementation is not embeddable. Mono is, but isn't sandboxed either
  • Javascript (V8): Meant to be embedded, sandboxed and well-known ==> fulfills requirements

So, as you can see, only Javascript is an imaginable solution, even if it's a huge code base and takes much more time to compile (we're talking about a factor of >50-100x compared to Lua). That's basically the reason why Lua is loved in embedding contexts.

Also, in my opinion Lua is actually a pretty good language: It's very easy to learn, it's one of the most flexible languages I know (considering metatables) and easy to embed (even though the C Interface is a bit old-school).

  • Like 8

Share this post


Link to post

am really didn't understand what is the wrong with lua?

Edited by Master_MTA

Share this post


Link to post

Sometimes needs more speed in Lua, using LuaJIT will resolve this problem.

I don't know a current progress level of LuaJIT integration into MTA, maybe someone can answer on this question?

Edited by Kenix

Share this post


Link to post

Some advanced functions and addons could be optional, easy to block by hosting. If someone like to destroy own server - no problem. I said that milion times.

Share this post


Link to post

i said " destroy own server" not "hack client/players"

like web browser, server can ask player "do you agree to load XYZ website".

Edited by PolskiSebek12

Share this post


Link to post

So what's the point blocking it for clients but not for the server itself? So much for the trust of community resources :P

Besides, I can't see any benefits - there are quite a few restrictions in Lua, however it doesn't matter due to the MTA functions provided to us.

Share this post


Link to post
4 hours ago, Kenix said:

I don't know a current progress level of LuaJIT integration into MTA

It was stopped, because it didn't perform significantly better than without JIT. As far as I recall it's related to the context switches between Lua and C++ being too expensive.

@Topic:
I've recently stumbled upon a language called Haxe. It's a statically typed language that compiles to other (well-known) languages - including Lua where it's syntax is pretty similar to Java.
I also did a few experiments which work quite well:  https://github.com/Jusonex/haxe-mtasa-typings/blob/master/Main.hx

  • Like 1

Share this post


Link to post
18 hours ago, Jusonex said:

It was stopped, because it didn't perform significantly better than without JIT. As far as I recall it's related to the context switches between Lua and C++ being too expensive.

@Topic:
I've recently stumbled upon a language called Haxe. It's a statically typed language that compiles to other (well-known) languages - including Lua where it's syntax is pretty similar to Java.
I also did a few experiments which work quite well:  https://github.com/Jusonex/haxe-mtasa-typings/blob/master/Main.hx

Nice! But this could be optional example:

<script src="main.hv" type="client" language="Hexe" />

Share this post


Link to post

It's too big to be integrated in MTA directly for the few people that will actually use it.

Also, there are plenty of good build tools that can be used to automate the process (e.g. recompile automatically on changes) since Haxe compiles to plain Lua that works without any code modification. If there's more interest on that, I could provide an example pipeline.

First, someone has to complete the type definitions though (see https://github.com/Jusonex/haxe-mtasa-typings/blob/master/mtasa/server/Element.hx for an example - it refers MTA's OOP methods).

Share this post


Link to post
On 24.08.2017 at 20:34, Jusonex said:

It's too big to be integrated in MTA directly for the few people that will actually use it.

Ye, cause bitwise operators were sooo important :D ...

Cool feature would be to extend existing MTA classes like Vehicle, Pickup etc. because we could easily make new classes like PoliceVehicle, RacePickup for cleaner code of course. 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.