• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community

Benefits of use Lua? (1 Viewer)

Herly Quijano

Newcomer
Joined
Mar 19, 2021
Messages
45
Reaction score
4
After a while using Lua, I asked myself, why should I? because is not type-safe because there are not types and is too permissive when it compiles because the way it interpret the code, making harder find errors.
The benefits I can think are is too flexible making it easier to code, but I'm not sure if it's worth.

So can you tell me if there are more benefits about using Lua than I think?
 

Sonazuma

Administrator
Staff member
Joined
Jan 6, 2020
Messages
33
Reaction score
10
After a while using Lua, I asked myself, why should I? because is not type-safe because there are not types and is too permissive when it compiles because the way it interpret the code, making harder find errors.
The benefits I can think are is too flexible making it easier to code, but I'm not sure if it's worth.

So can you tell me if there are more benefits about using Lua than I think?
The main benefit of using Lua is that you do not have to recompile large C++ projects. You can make changes, reload Lua scripts, and see its effect, while your C++ program is running.

Lua scripts do not usually implement core/critical functionality, but is rather used for addon/extension functionality.
 

stetre

Member
Rank: I
Joined
Jan 8, 2020
Messages
75
Reaction score
46
Location
Italy
Website
github.com
The question "should I use language X?" is a bit ill-defined. The choice of a programming language depends on many things: the nature of the task at hand, its requirements (target platforms, performance, robustness, cost, milestones, ...), the availability of tools and, last but not least, of expertise.

Like all programming languages Lua has its strengths and its weaknesses, but if you stop and think about it, most of them are actually 'traits' that can be either strengths or weaknesses depending on the above requirements. A dynamic types system, for example, is a weakness if you are writing a critical application. But if you are prototyping, or writing casual code, or giving your non-tech-savy-user ways to extend an application with properly sandboxed script, it's a boon.
 

Herly Quijano

Newcomer
Joined
Mar 19, 2021
Messages
45
Reaction score
4
The choice of a programming language depends on many things
I guess I have to say why I started to use Lua, is because the game (Warcraft 3) started to support Lua relatively recently, so I wanted to learn more about this language to create maps, and its other progamming language is too basic and limited.
The reason why I asked to know if should I stay in Lua is because some people made possible use TypeScript to translate the code to Lua and then creating the map using it.
 

stetre

Member
Rank: I
Joined
Jan 8, 2020
Messages
75
Reaction score
46
Location
Italy
Website
github.com
I guess I have to say why I started to use Lua, is because the game (Warcraft 3) started to support Lua relatively recently, so I wanted to learn more about this language to create maps, and its other progamming language is too basic and limited.
The reason why I asked to know if should I stay in Lua is because some people made possible use TypeScript to translate the code to Lua and then creating the map using it.

Well, then in this case the choice is restricted to a couple of alternatives, so it's just a matter of figuring out a few things: what are the advantages of using Typescript over Lua in this particular application (surely not performance), how reliable/documented/supported (in the foreseable future) are the tools provided by those people, and perhaps how do you like Typescript programming/how difficult is it to learn (if you don't know it already).

Maybe you'd be better off asking the Warcraft 3 community.
 

Herly Quijano

Newcomer
Joined
Mar 19, 2021
Messages
45
Reaction score
4
Well, then in this case the choice is restricted to a couple of alternatives, so it's just a matter of figuring out a few things: what are the advantages of using Typescript over Lua in this particular application (surely not performance), how reliable/documented/supported (in the foreseable future) are the tools provided by those people, and perhaps how do you like Typescript programming/how difficult is it to learn (if you don't know it already).

Maybe you'd be better off asking the Warcraft 3 community.
I asked them and that was some of the first things they suggested me, so I asked to the Lua community a second opinion, and yes, my principal limit is I don't know nothing about TypeScript, in fact I started to learn Java and is more difficult than Lua and until I heard TypeScript is similar to Java but I saw differences between them.
 

stetre

Member
Rank: I
Joined
Jan 8, 2020
Messages
75
Reaction score
46
Location
Italy
Website
github.com
I asked them and that was some of the first things they suggested me, so I asked to the Lua community a second opinion, and yes, my principal limit is I don't know nothing about TypeScript, in fact I started to learn Java and is more difficult than Lua and until I heard TypeScript is similar to Java but I saw differences between them.

Gosh, if you have to learn Java before learning Typescript it will take you years! Maybe you misheard Java for Javascript? Despite the similar name they are very different languages, and while Javascript is more or less in the same league as Lua, Java is an entirely different beast.

By the way, this is one very good reason for which Lua is often used in games for scripting: it is a minimal language, with very few constructs and keywords and a not-so-steep learning curve, so users can grasp it in a short time and with minimal effort.
 

stetre

Member
Rank: I
Joined
Jan 8, 2020
Messages
75
Reaction score
46
Location
Italy
Website
github.com
Is because the university ask me for that.

Sorry, I misunderstood that you were learning Java just for this purpose.

You see, Lua (actually its predecessor, Sol) was originally designed to be used by engineers working on oil platforms. That is, it was intended to be used proficiently to customize applications by people that despite being technician, were not software people at heart, and did not have the time to spend learning all those CS concepts that are required to use more sophisticated languages such as Java, C, C++, and so on. Unintentionally for the language designers (who didn't have games in mind) this made a perfect match for games, where the situation is similar: gamers often just want to mod games but are not interested (or do not have the time or means) to learn computer science, so in a sense they are a demography similar to the oil engineers targeted by Lua's designers. That's why Lua, and scripting languages in general, are used for this purpose, despite being somewhat limited as you already noticed. The idea is however to use them just to extend or modify an already existing application, not to write the critical parts of it, so the language limitations are usually not a concern.
 

Herly Quijano

Newcomer
Joined
Mar 19, 2021
Messages
45
Reaction score
4
Sorry, I misunderstood that you were learning Java just for this purpose.

You see, Lua (actually its predecessor, Sol) was originally designed to be used by engineers working on oil platforms. That is, it was intended to be used proficiently to customize applications by people that despite being technician, were not software people at heart, and did not have the time to spend learning all those CS concepts that are required to use more sophisticated languages such as Java, C, C++, and so on. Unintentionally for the language designers (who didn't have games in mind) this made a perfect match for games, where the situation is similar: gamers often just want to mod games but are not interested (or do not have the time or means) to learn computer science, so in a sense they are a demography similar to the oil engineers targeted by Lua's designers. That's why Lua, and scripting languages in general, are used for this purpose, despite being somewhat limited as you already noticed. The idea is however to use them just to extend or modify an already existing application, not to write the critical parts of it, so the language limitations are usually not a concern.
Hmm, interesting.
 

hemmerling

Newcomer
Joined
Jul 7, 2021
Messages
9
Reaction score
4
One argument for Lua is,
that the next Lua world conference ( called "Lua Workshop" ) is limited to 100 people, I can´t figure out if this was typical for past events, so it will be a very personal & intimate experience in the means "you might even meet the Boss" ( = Roberto ) and "everybody knows everybody in the Lua scene".

See

Lua is by this competitive to Forth ( no world conference at all, US activities can be considered to be zero, largest meeting events worldwide are in Germany ) and Tcl/Tk ( annual US and annual European conference, at least the European conference has usually much less than 100 participants ) :)

Seriously, LUA ist the #1 scripting language for game engines and online game developer platforms ( though the top-2 game engines - Unity and Unreal - don´t support LUA, but many other game engines do ).
 
Last edited:
Top