Jump to content

Is there a reason for Lua?


Recommended Posts

Hey guys. So I was just wondering if there is a reason that the MTA devs decided to use Lua for the scripting language, instead of something like Ruby or Python, or is it just something that they just decided because it was there? I don't know why I want to know this, but I was just curious.

Thanks.

Link to comment
Lua is light, fast, is used by a good amount of videogames and some recognized videogames companies.

Yes, but there are tons of other languages that do the same thing.

Name multiple AAA games that use python as their language. Here's a list for lua.

http://en.wikipedia.org/wiki/Category:L ... ideo_games

Lua might be light what you say, but people only implement it, cause its easy to.

Python is much better than lua, much faster, much more stable, and more stable.

Lua < JavaScript < Python

If you ask any of those who know all the languages, they will say the same, even if they love on of the more. Python has more capabilites, and prooved me a lot in CSS, or in Socket. Statistic doesn't matter, a language can be popular for anything.

Link to comment

They implement it because it's widely used, it has great documentation, it's lightweight, it's fast (not even mentioning LuaJIT) and it's actually stable (how dare you to say Lua isn't stable enough?). If (game) developers said Python was a better choice, logically they wouldn't be using Lua in their projects.

Link to comment
  • 2 months later...

Lua was an easy language to embed, and also fairly widely used in the games industry. It's undoubtably not the best language - Python is certainly better, but from what I remember, we looked at embedding python, but it wasn't terribly easy to do. There was also probably an element of naivety - it was the first time anyone had integrated a scripting system into another game like this, and it was certainly quite experimental at the time - both in principle and for those doing the implementation.

That said, there are certainly worse languages to use. Lua has very little boilerplate which makes it very easy for beginners to get started. It doesn't scale well to large systems, unless you're very careful about how you write your code, but then that applies to Python too.

Link to comment
Lua might be light what you say, but people only implement it, cause its easy to.

Python is much better than lua, much faster, much more stable, and more stable.

Lua < JavaScript < Python

If you ask any of those who know all the languages, they will say the same, even if they love on of the more. Python has more capabilites, and prooved me a lot in CSS, or in Socket. Statistic doesn't matter, a language can be popular for anything.

"Much faster" how? "More stable" how? And what capabilities are you talking about? Lua is Turing complete language, therefore it is capable of solving any computational problem, just like Python. If you're talking about stuff in Python standard library which should not be allowed to be freely executed by scripts downloaded from servers, then they would have to be reimplemented anyway for security reasons. It's like with file functions, Lua has them but MTA disables them and instead provides its own file functions to prevent the scripts from messing with files anywhere outside resources directory.

That said, I like both Lua and Python. They're my favorite scripting languages, but I still prefer Lua for its simplicity. I don't remember encountering stability problems and because of variety of criteria for performance, I can't see Python as "much faster" than Lua. Personally, I would like to see both Lua and Python in MTA, but since one language can already be used to do all the stuff, second one would provide little benefit, especially since potential security issues would need to be taken care of.

I agree that ad populum is a bad argument though. "People say so" has never been an accurate way to determine the objective reality. That's why I don't use popularity as an argument except as a troll response to opponents who use the same fallacy xD

Link to comment

The real question here is why would you need Python in your game? It's extremely broad in what it can do and that isn't necessary for most games. Lua can provide enough scripting functionality. Python is far too expansive as others stated, to act as just a scripting language for your game.

Link to comment
I think that the best choice would be C# (mono).

Why MTA can not use multiple languages like as Unity3D?

It'd be really amazing if MTA had multi-language support for scripting, although I highly doubt it would happen.

And I do agree with you, C# would be a nice choice.

Link to comment
What about LuaJIT? Or 5.2? Could MTA use one of those?

As far as I know JIT is "api compatible", does that mean it could be a drop-in replacement for 5.1 in MTA?

There's even a binary for jit branch: https://nightly.multitheftauto.com/ but for server only.

It's still very WIP. We're doing stress testing with some various servers right now and when we're ready to release it, you'll see it. No promises of when.

Link to comment
  • 5 months later...
Lua might be light what you say, but people only implement it, cause its easy to.

Python is much better than lua, much faster, much more stable, and more stable.

Lua < JavaScript < Python

If you ask any of those who know all the languages, they will say the same, even if they love on of the more. Python has more capabilites, and prooved me a lot in CSS, or in Socket. Statistic doesn't matter, a language can be popular for anything.

"Much faster" how? "More stable" how? And what capabilities are you talking about? Lua is Turing complete language, therefore it is capable of solving any computational problem, just like Python. If you're talking about stuff in Python standard library which should not be allowed to be freely executed by scripts downloaded from servers, then they would have to be reimplemented anyway for security reasons. It's like with file functions, Lua has them but MTA disables them and instead provides its own file functions to prevent the scripts from messing with files anywhere outside resources directory.

That said, I like both Lua and Python. They're my favorite scripting languages, but I still prefer Lua for its simplicity. I don't remember encountering stability problems and because of variety of criteria for performance, I can't see Python as "much faster" than Lua. Personally, I would like to see both Lua and Python in MTA, but since one language can already be used to do all the stuff, second one would provide little benefit, especially since potential security issues would need to be taken care of.

I agree that ad populum is a bad argument though. "People say so" has never been an accurate way to determine the objective reality. That's why I don't use popularity as an argument except as a troll response to opponents who use the same fallacy xD

Lua is not readable. Stinks. Ugly. Not simple at all. Python is. Programming in Python rather than LUA. Everyone would do that if they would be allowed. Python might not be small, but It has more libs. If It would be C#, IronPython would kill your lua 5.1.

Actually putting Python in would bring more people, since looking at SAMP has the other ugly shit called pawn.

We need modern languages. And looking at this: http://githut.info just proves me that MTA would benefit more than using LUA.

Link to comment
  • 4 weeks later...
  • MTA Team

Will there ever be an upgrade from Lua 5.1 in MTA? (5.3 is the current release)

There have already been two releases since 5.1 and it feels a bit dated.

Upgrading Lua to 5.2 or 5.3 would cause quite some issues. Many servers are using old code which may be incompatible to newer Versions of Lua without several changes. Furthermore upgrading Lua would cause all compiled scripts to break, which would be a huge issue for servers using scripts which are not available as source code (as an example: many public race maps use compiled scripts for random things). If you're lacking some specific feature of 5.2 or 5.3 there's most likely a workaround or an alternative available.

Link to comment

Will there ever be an upgrade from Lua 5.1 in MTA? (5.3 is the current release)

There have already been two releases since 5.1 and it feels a bit dated.

Upgrading Lua to 5.2 or 5.3 would cause quite some issues. Many servers are using old code which may be incompatible to newer Versions of Lua without several changes. Furthermore upgrading Lua would cause all compiled scripts to break, which would be a huge issue for servers using scripts which are not available as source code (as an example: many public race maps use compiled scripts for random things). If you're lacking some specific feature of 5.2 or 5.3 there's most likely a workaround or an alternative available.

All scripts are written in Lua 5.1.4 works fine on Lua 5.3. Lua developers made sure that the old scripts have worked successfully in the new versions. What have MTA done with Lua, they can not update it?

Link to comment
  • MTA Team
All scripts are written in Lua 5.1.4 works fine on Lua 5.3.

This is not correct. There are breaking changes in 5.2 and 5.3 which will break (some) existing scripts. As a very simple example, the following code will error under Lua 5.2 while being totally fine in 5.1.

  
print(unpack({1,2,3})) 
  

Also 5.2 and 5.3 introduce new opcodes which entirely break compiled files.

Link to comment
  • 2 weeks later...
  
print(unpack({1,2,3})) 
  

unpack=table.unpack, pliz

I have not tested it, but it seems like most of the removed stuff can very easily be ran with a few changes, not to mention that a compatibility layer could easily be implemented. As for bytecode, well, tough luck for closed source.

What most I heard most people complain about is the lack of setfenv, but MTA uses separate Lua states anyway, so I'm not sure anyone have ever used setfenv.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...