Jump to content

Why Lua?


Rex

Recommended Posts

I'm a software developer, but I never used Lua before writing scripts for DCS.  I notice quite a few other games/sims use Lua as their scripting language as well.

Of all of the interpreted languages out there ... why Lua?

I think it's a fine language, and am not complaining about it in the slightest, I'm simply curious.

 

Edit to add:

I did some searching, and found this.  Unless there is some specific reason for DCS, perhaps it answers the question:

https://www.makeuseof.com/why-is-lua-popular-for-game-development-how-to-use/

 

Why Lua Is Popular for Game Development

There are tens of game engines using Lua with many developers using the language in these game engines. Here is why the Lua programming language is very popularly used in most game engines.

Lua Is Simple

Here is a fact difficult to believe – Lua is simpler than Python, and it has a very short learning curve. With its simplicity, all data structures are represented almost the same way. It is easy to write functions, conditional statements, loops, and everything. With its intuitiveness, you can guess almost any statement, method, or function you don’t remember.

This feature of Lua makes it suitable for game development.

Lightweight and Fast

Although Lua is an interpreted language just like Python, it’s very fast and lightweight. In fact, it is one of the fastest interpreted programming languages, consuming little memory.

Embedded Language

Lua is also used for embedded scripts. You can use Lua for embedding an interpreter within a larger program in a different language. Lua also offers C APIs and this feature allows easy binding to C.

Moreover, you can embed Lua in other languages like C++, Java, etc. and this means you can create modifiable programs with that.

Free and Open-Source

Lua is free and open-source software. The source code is available and can be modified by any developer. Roblox uses a modified version of Lua, known as Luau (formerly RBX. lua), which is derived from Lua 5.1. 4; it wouldn’t have been possible if Lua wasn’t open-source.

Large Community

Hundreds of companies and game engines use Lua because of how suitable it is for game development. The growth of the Lua community is vast because of the many game engines using Lua. Help is available for almost anything, and you will never feel lost when using any Lua framework.

For instance, Roblox as a company has its own educational services, where instructors can teach you how to make use of Roblox Studio to build anything you imagine, including how to code using Lua.


Edited by Rex
add found info
  • Like 1

Rex's Rig

Intel i9-14900K | Nvidia RTX 4090 | 64GB DDR5 | 3x4TB 990 Pro M2 SSDs | HP Reverb 2 | 49" Samsung 5120x1440 @ 120Mhz

TM Warthog Stick + Throttle | TM Pendulum Pedals | MS Sidewinder 2 FFB | Track IR |  Cougar MFD x 2 

 

Link to comment
Share on other sites

It's fast, and flexible, and when you have so many fast moving objects to update across clients it works a treat. On the flip side the syntax is easy to learn but much harder to master, and if you have Lua written in a bad way it can bring the whole thing down and debugging it isn't as straight forward as most. I love it, I think it fits DCS well.

I tried built a ML application that took mission data at runtime and it was so cool, Python is a cool language and Lua 5.1 feels dated compared, but it was so slow I abandoned it and moved onto other things.

  • Thanks 1

Creator & Developer of XSAF ::An AI model that wants to kill you, and needs no help from humans.

Discord: PravusJSB#9484   twitch.tv/pravusjsb  https://www.patreon.com/XSAF  https://discord.gg/pC9EBe8vWU https://bmc.link/johnsbeaslu

Work with me on Fiverr: https://www.fiverr.com/pravusjsb

Link to comment
Share on other sites

  • Recently Browsing   0 members

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