Why Is Lua So Popular?

  Рет қаралды 81,275

Awesome

Awesome

Күн бұрын

An overview of the Lua Programming Language.
💬 Topics:
- What is Lua?
- Getting started with Lua?
- Lua basic example;
- Lua types;
- Working with Lua control flow;
- Data structures in Lua;
- Lua Standard Library
- Lua Tables and Metatables;
- Luat Coroutines.
👊 Join us - / @awesome-coding
📖 Blog Article - www.awesome.club/blog/2024/7-...
📈 Usage charts - github.blog/2023-11-08-the-st...
📚 Chapters:
0:00 - Lua Basics
1:40 - Coding in Lua
2:45- Types & Values
3:45 - Control Flow
4:15 - Data Structures
6:10 - Coroutines
6:40 - Working with C
7:25 - Ecosystem

Пікірлер: 326
@dameanvil
@dameanvil 3 ай бұрын
00:00 🚀 Lua ranks second in the fastest-growing programming languages for open source projects, closely following Rust. 1:49 📋 Lua is an efficient, lightweight, and dynamically typed scripting language with 22 keywords and 8 basic types. 2:49 🔄 Lua is dynamically typed, with variables not having types; only values do. Local variables are preferred for performance and scoping reasons. 3:48 ⚖ Lua's control flow includes if-then-else, while loops, and repeat-until loops, with numeric or generic for statements for table iteration. 4:18 🗃 Lua's table is the sole data structuring mechanism, versatile for records, dictionaries, arrays, and more. 5:04 🧠 Lua's automatic memory management, with a garbage collector, simplifies memory handling, while metatables enhance table flexibility. 6:04 📚 Lua's standard library, implemented in C, includes coroutine support for non-preemptive multitasking. 6:39 🚀 Lua's efficiency is attributed to its C implementation, making it portable and easily embeddable in C-based applications. 7:24 🌐 Lua's ecosystem is supported by a module system and the LuaRocks package manager, with various libraries, frameworks, and community involvement.
@awesome-coding
@awesome-coding 3 ай бұрын
Thank you!
@evccyr
@evccyr 4 ай бұрын
Neovim plugins obviously
@CrazyLuke11
@CrazyLuke11 4 ай бұрын
Yeah 😅
@vaisakhkm783
@vaisakhkm783 4 ай бұрын
Even though recent popluarity is due to neovim, it is a really popular lang, from pandoc and mpv, vlc to even adobe photoshop interface is written in lua....
@unendlicherping318
@unendlicherping318 4 ай бұрын
Roblox is also very big
@universaltoons
@universaltoons 3 ай бұрын
@@unendlicherping318 roblox uses luau
@MohaaAbdi
@MohaaAbdi 3 ай бұрын
Good one😂
@spicybaguette7706
@spicybaguette7706 4 ай бұрын
Lua is so simple that, presuming you have some programming experience, you can learn the basics in a couple of hours
@awesome-coding
@awesome-coding 4 ай бұрын
Yep!
@pinatacolada7986
@pinatacolada7986 3 ай бұрын
Yeah. I learned it to write a homebrew PSP game back in 2010. Very strange to see it so popular considering it was created back in 1993!
@tommyhardiman8557
@tommyhardiman8557 3 ай бұрын
I would like to correct you slightly, it's so simple, that presuming you have no programming experience (like me), you can learn the basics in a couple of hours. it really is incredibly simple, I use it almost daily now
@tuananhdo1870
@tuananhdo1870 2 ай бұрын
The point is where to use that knowledge. I learned it but i am not have any work that using Lua
@Bunny99s
@Bunny99s 2 ай бұрын
Not only that. I would say because it's that simple it's one of the few languages where you ( I ) can claim to "know" the language as a whole. Most languages have some rarely used obscure syntax or features you may have never heard of since you never used it. Just reading through the lua specs is really fun. The meta functions alone offer so much potential. Multi-value support for return types and assignments haven't been mentioned. But lua allows things like a,b = b,a which would swap the content of a and b. A multi value return can also be simply wrapped in a new table t = {someMethod()} Coroutines are even more awesome compared to other languages which may also have some sort of coroutines. First of all you can yield even in nested methods which would still suspend the next upper coroutine. You could think of it like an exception handller, though it actually preserves the callstack and resumes at the yield call. The yield call is much more than just an execution yielding operation. You can actually pass arbitrary data (multi value) to the yield method. Those parameters are actually returned to the caller who called coroutine.resume on your coroutine. Likewise the yield call will return values which are passed to the resume method by the caller. So it's allows two way communication between the caller and the coroutine. Implementations like in the Minecraft mod Computercraft use this mechanic to implement messages. So every program you run in CC is actually a coroutine and the game passes events that way. So the yield instruction is essentially the message pump. You can actually pass a string to the yield function and the game would interpret that as a message filter. So this coroutine would not be resumed unless the specified message comes along. That's how things like sleep is implemented. This mechanic allows incredible flexibility as you can even implement your own scheduler inside lua to further distribute events. The game actually ships is a very simple "parallel" api which allows you to simply have several coroutines run in "parallel". I'm mainly a C# programmer, but lua has been my favourite scripting language for years. MoonSharp is a pure .NET implementation of lua. Since the Unity game engine can build your project to WebGL / javascript I successfully have lua support in a game running inside a browser, which is awesome ^^. Of course inside the browser we don't really have threading support and having a scripting language that can dead-lock / busy-spin is not good. Though the interpreter already has a built-in way to issue a special yield every x instructions, so even an infinite loop is not really an issue and with some extra work this mechanic can be used as a load balancer and dead-lock detector. Another great thing abour lua is because it's that simple and doesn't really have custom data types, code can easily be re-used even if some library is missing as long as you can provide the necessary methods. I often use lua to explain to others how OOP and classes in other languages actually work under the hood. In most compiled languages (C,C++,C#,....) all methods are technically static methods. So code never "lives" in an object instance but only the class. The trick is that when you do obj.SomeMethod(123, "abc") the compiler actually calls the static method and passes the object as first argument. So the call above becomes SomeClass.SomeMethod(obj, 123, "abc") Of course dynamic dispatch (virtual methods / polymorphism) adds another layer of indirection, but the code is still static. Lua has a neat extra operator that helps with implementing the concept of OOP. Instead of using a dot, you can use a colon to call a method. This does exactly what I just described. So when doing someTable:method(42) it actually does someTable.method(someTable, 42) since you can simply "map" methods into a table via meta tables, you can call a method that doesn't exist in the table itself but is defined in the "class" of that object and when using the colon operator, you can implicitly pass the object itself to the method, so the method can mutate / use the object. I started programming "almost" 30 years ago with pascal. That's why I don't mind the "if then" and "end" syntax. At least lua doesn't require a "begin" :) I could talk for hours about lua, but I just realised that I'm just writing a comment on YT and I should probably stop now ^^
@dkuppens5357
@dkuppens5357 3 ай бұрын
I used Lua already 20 years ago in an embedded realtime machine contol system. All known requirements for funcionality were hardcoded in C but lua allowed us to implement and try new functionality quickly. Once the requirements were known the lua code was ported to c code. I also added a terminal to add and execute lua code while the machine was running. This saved us soo much debug time. The combo LUA and C (Later C++) is absolutely fantastic! Great to see it is becoming so populair.
@hansolololol
@hansolololol 2 ай бұрын
doing exactly this for work 20 years later :) We use LuaJIT for the FFI which makes C interop so damn simple.
@zulupox
@zulupox 3 ай бұрын
I love lua. The fact that it is a tiny language, is the very reason it is so nice: It makes code very easy to follow, since there isn't a myriad different ways to implement things.
@davidd355
@davidd355 3 ай бұрын
Eu tive o prazer de estudar com uma das professoras que estavam no projeto da linguagem lua quando ela foi criada Sinto muito orgulho dela ser uma linguagem Brasileira!
@awesome-coding
@awesome-coding 3 ай бұрын
👏🏻👏🏻👏🏻
@rogeriopenna9014
@rogeriopenna9014 3 ай бұрын
in case anyone doesn´t have the function to translate "I had the pleasure of studying with one of the professors that were in the Lua Language Project when it was created. I am very proud of it being a brazilian language.
@Srvtnc
@Srvtnc 11 күн бұрын
que foda
@siriusleto3758
@siriusleto3758 3 ай бұрын
Simplicity, small (130 KB), uses a virtual machine, few instructions, easily linked to C libraries, easy to embed in any other language, Engine or other type of software
@mensaswede4028
@mensaswede4028 3 ай бұрын
This is why I use at my company. I’ve written code to call LUA from Java, Swift, and of course C++ to embed it into our mobile apps. Also made it so Java, Swift and C++ can call LUA. It’s just so easy to embed because you can compile it with any C compiler and gluing it to any other language is just a matter of writing some C code.
@frityet2840
@frityet2840 4 ай бұрын
I love lua so much it's unreal, I write everything in lua, and I am also writing an operating system based around Lua. Favourite language of all time
@Chara556
@Chara556 4 ай бұрын
Operating system? IS this even possible? Tell me abt everything Im excited to know
@PamellaCardoso-pp5tr
@PamellaCardoso-pp5tr 4 ай бұрын
​@@Chara556well lua interop with C quite easily, so you can a Lot of stuff with It. Adobe Photoshop interface is written in Lua for example
@Chara556
@Chara556 4 ай бұрын
@@PamellaCardoso-pp5tr why isnt lua só famous RN like python etc
@Redyf
@Redyf 3 ай бұрын
​@@Chara556index starts at 1 🤣
@taihuynhuc3135
@taihuynhuc3135 3 ай бұрын
@@Chara556Lua is only designed to be used as a embedding language (to be used on top of C, C++, etc). Therefore, it’s fast, minimal but also limited and lacks a lot of stuffs.
@marcotrosi
@marcotrosi 4 ай бұрын
I use and love Lua since around 2008, for me personally there is no better language and paired with C to me it's unbeatable.
@Templarfreak
@Templarfreak 3 ай бұрын
while Lua's standard library is quite small, it's quite easy to implement a lot of different libraries, and there is a huuuuuge amount of libraries available. it is very easy for tables to represent virtually any other kind of data object, so it's extremely easy to implement a variety of data structures a well, ranging from priorities queues to binary trees to linked lists. there are libraries available to parse json or xml files into tables in a way that still feels very intuitive and natural (or at least definitely for json). local scoping can also be done in a file as well, and because of that, closures, and metatables, you not only can _completely_ follow oop principles with private methods and fields or static private methods and fields, but you have multiple different ways you can do it with different advantages and disadvantages if your concern is speed, memory, or readability / maintainability. in Lua 5.3 and up, you also have explicit integers, ie with no decimal, which has some advantages that Lua's numbers did not have before (namely accuracy), and in 5.4 you have the const keyword.
@crism8868
@crism8868 3 ай бұрын
Your videos are quick and straight to the point while still easy to follow along, subscribed!
@awesome-coding
@awesome-coding 3 ай бұрын
Thank you! I really appreciate it!
@Maxjoker98
@Maxjoker98 2 ай бұрын
This video is great. I've been programming in Lua for years and years now, and I've grown to really like the Lua language. I think a very important thing to mention when talking about Lua is LuaJIT. LuaJIT is fully compatible with Lua 5.1 and is so fast that it can regularly out-perform my hand-written C code with some trivial Lua code(Lua code is usually shorter and more readable as well). It's not only fast during the runtime running the JITed code, but also when interpreting non-JITed code thanks to it's hand-optimized interpreter and data structures. And it's startup time and binary size(~500K on my machine) is also tiny compared to other scripting languages. Not to mention the FFI, which not only allows you to call C functions from Lua, but also exposes the C data types for your convenience. The FFI data types are integrated into LuaJITs optimization passes, and so using the FFI can actually speed up regular Lua code as well, by enabling C-style arrays, pointers, manual memory management, structs, etc. to be used directly from Lua when needed, at the cost of memory safety(can't be avoided when working with C APIs).
@joaopauloalbq
@joaopauloalbq 3 ай бұрын
I see a lot of potential in Lua and I love its simplicity...just a data structure? Wow it's so cool. There is also an implementation of the Lua language with a just-in-time compiler, called LuaJIT, which is stupidly fast, sometimes as fast as C 🤯
@anon_y_mousse
@anon_y_mousse 3 ай бұрын
Apparently it's a little known fact, but you can compile vanilla Vim with support for Lua and I do every time I update the one I have installed. As an extra tidbit, you could also build it with support for Perl, Python, Ruby, TCL and a few other languages I can't remember.
@herrpez
@herrpez 3 ай бұрын
Thanks, but I build my Vim with Elisp support. Wait, no... I'm a dum-dum... I build my Elisp platform with Vim support. 😉
@gustavojoaquin_arch
@gustavojoaquin_arch 26 күн бұрын
Neovim is better
@anon_y_mousse
@anon_y_mousse 26 күн бұрын
@@gustavojoaquin_arch What's your empirical reasoning? Is it better defaults? If so, does that mean you do less configuration?
@gustavojoaquin_arch
@gustavojoaquin_arch 26 күн бұрын
@@anon_y_mousse idk exactly how much is the difference in configuration options, but in neovim I find much more plugins than vim
@SRG-Learn-Code
@SRG-Learn-Code 4 ай бұрын
I discovered LUA with Tabletop Simulator. Is a "game" that let's you spawn custom models and textures so you can prototype boardgames. The thing is that instead of prototyping your own games you can "rip" popular games and... it has LUA integrated to make scripts, like could be set the game for different players or to keep score. It's really neat, and as you said, is small enough you can embed it in other apps. I really liked working with it. Array 1 is based.
@awesome-coding
@awesome-coding 4 ай бұрын
Interesting. I'm finding out Lua is available in way more games than I initially thought.
@SRG-Learn-Code
@SRG-Learn-Code 4 ай бұрын
@@awesome-coding It might have a snowball effect. If you want your game to be scriptable you may look into other games that did that or you got directly inspired by a game you played. I wonder who set the trend in that. In any case, seems like LUA has some attributes that makes it prone to help in that. LUA is good. Most likely not the most performant or "complete" language, but you don't always need that. That's also why JS and Python are so popular.
@Mark-kt5mh
@Mark-kt5mh 4 ай бұрын
Lua isn't an acronym, it's the Portuguese word for moon
@SRG-Learn-Code
@SRG-Learn-Code 4 ай бұрын
@@Mark-kt5mh Mmm, like the luna, interesting.
@herrpez
@herrpez 3 ай бұрын
@@SRG-Learn-Code Exactly like luna; they share the same etymological roots!
@gabrieljose7041
@gabrieljose7041 4 ай бұрын
Lua is great and simple language, I mostly used it with game dev and a few times with neovim, but never with web dev or something like that
@BosonCollider
@BosonCollider 2 ай бұрын
Having coroutines like Ruby technically makes it better suited for a backend web server than Python or Javascript ever were, but much like Ruby it got shoehorned into a specific niche. Most likely because Lua's standard library is not batteries included
@zekiz774
@zekiz774 3 ай бұрын
This gives me nostalgia. It was the first programming lanugage I learned and completed a tutorial of when I was like 12 or 13. I tired to write a mod for Minetest at the time and it actually kinda worked. Sadly I don't have the files anymore.
@Bunny99s
@Bunny99s 2 ай бұрын
I still play minecraft to this very day (with some down time in between) and I almost always play with mods and ComputerCraft / CCTweaked is almost always included :) Currently I'm back at SkyFactory3 which unfortunately doesn't have CC but instead OpenComputers. It also uses lua but is a bit more bulky. Those 95% of the code could be reused anyways :D I actually host all my lua code on my raspberry pi and I load them from the webserver it runs.
@SianaGearz
@SianaGearz 3 ай бұрын
It's a very smart and capable language and JavaScript wishes it was this elegant. However 1 based array addressing drives me up the wall!
@awesome-coding
@awesome-coding 3 ай бұрын
😅
@waltermelo1033
@waltermelo1033 3 ай бұрын
I can understand why it is like that, by the context it was created. it was invented at Rio de Janeiro, for regular people do some scriptings. probably people had problems with arrays starting at zero so. to avoid confusion to them they just did it.
@christopheroliver148
@christopheroliver148 3 ай бұрын
Remind yourself never to mess around with Smalltalk then. (Smalltalk arrays too are origin 1.)
@SianaGearz
@SianaGearz 3 ай бұрын
@@christopheroliver148 i have not the faintest intention. And yeah I know when I wrote my very very first programs in ZX Spectrum BASIC and later Pascal 30ish years ago, it also seemed more natural to lean on 1 based arrays, you can just specify how you want them case by case in Pascal, but eventually 0 based ones grew on me after playing around with them some more.
@jongeduard
@jongeduard 3 ай бұрын
Not developing with it myself, but I have touched it sometimes the past in for a bit of scripting inside a simulator program. Syntax looks a lot like Pascal/Delphi, with very similar if, for, while and repeat syntax, and the indexing from 1 instead of 0. Maybe also a bit of VB like. But all with a really strong JS sense inside it. All objects are associative arrays, hash tables (hence the name, tables). And everything dynamic. Lua is older than JS though. Also very interesting to see that JS was really not the first language which came up with this whole associative array based objects concept! It looks like numbers in Lua work a lot better than in JS though, because i do not see so many floating point precision issues. It also looks like Lua actually has some distinction between integers and floating points, because when I type 5.0 I am getting 5.0 back from the interpreter, while when I type 5, I am actually getting 5 back. So I do not really believe that Lua has only one numeric type.
@MH_VOID
@MH_VOID 3 ай бұрын
Yes, Lua under the hood dynamically uses either ints or floats to represent numbers, both 64 bit by default, though you can compile it to use 32 bit ones. Rules are sanely described in section 3.4.3 of the manual (of 5.4, the latest version). Section 2.1, where it introduces them, also states that NaN, unique of all non-nil values cannot be a table index... still better than JS though Haven't heard of Delphi in a while (though I do hear about Pascal every now and then) I find Lua to be a rather elegantly minimal embedding language, though I personally think programs should really just use a Lisp dialect or something instead.
@jongeduard
@jongeduard 3 ай бұрын
​@@MH_VOIDThanks for clarifying. That makes it clear. When it comes to Lisp, I have never written in it, but I know two things. One is that some people are really positive about it. Another thing I know is that it has a lot of parentheses. :P Maybe I will look at it some day.
@christopheroliver148
@christopheroliver148 3 ай бұрын
To me (and some others) it's basically Scheme with Pascal syntax.
@avishevin1976
@avishevin1976 3 ай бұрын
Lua's popularity is almost certainly due to its use in MMORPGs and other games that allow UI mods. World of Warcraft is the single most popular online game of all time and it allows addons written in Lua. Many games have followed suit.
@andreroodt4647
@andreroodt4647 4 ай бұрын
I never tried Lua outside of scripting for nginx, so I don't feel the same love for it as others in the comments. However, I don't ever recall our Lua scripts being the cause of any performance issues, even with 50K requests/s and some complex scripts. Considering it was designed to be an embedded language it is certainly fit for purpose when it comes to nginx.
@awesome-coding
@awesome-coding 4 ай бұрын
Interesting! Thanks for your input!
@BosonCollider
@BosonCollider 2 ай бұрын
Lua has god tier concurrency primitives thanks to coroutines (async await like perf without colored functions) and openresty makes full use of it by binding lua coroutines to nginx events. It's just a shame that the standard library isn't more batteries included.
@rogeriopenna9014
@rogeriopenna9014 3 ай бұрын
About Lua arrays starting with 1. Seems obvious, since it's based on tables and for common users, so I guess common users having experience with spreadsheets like Lotus, Excel and Quattro Pro. "Lua's choice for 1-based indexing is not arbitrary, though. It was influenced by its design goals of simplicity and its roots in the Petrobras company in Brazil, where Lua was developed. The choice aligns with human counting conventions (starting from 1) and some mathematical and engineering applications where 1-based indexing is the norm. "
@StellaEFZ
@StellaEFZ 2 ай бұрын
Lua wasn't developed in petrobras, Lua was developed by PUC-RJ to be used in a Petrobras project. PUC-RJ still maintains the project as well
@CEOofGameDev
@CEOofGameDev 4 ай бұрын
I think Lua is popular due to it's inherit Brazilian charisma. Same thing as Elixir...
@awesome-coding
@awesome-coding 4 ай бұрын
😂 100% accurate
@ShakilShahadat
@ShakilShahadat 4 ай бұрын
I learned Lua recently and absolutely loved it. Learning curve is minimal, fast compilation, very easy python like syntax, what not to love about it. You can even make games using the tiny Löve framework. Overall experience was very good.
@hctiBelttiL
@hctiBelttiL 3 ай бұрын
"very easy python like syntax" Very easy... what?? I can see why Python syntax seems easy at first - everything is very low entry barrier. But having to constantly stress about whitespaces will eventually take a toll on your soul. I'll take the "end" keyword any day of the week.
@herrpez
@herrpez 3 ай бұрын
​@@hctiBelttiL Stress about whitespace? It is something you need to pay attention to, yes... but no more than brackets in other languages. And unless you are exceedingly sloppy in your coding, the whitespace will take care of itself anyway. In either case it's more of a boon rather than a drawback. Very peculiar. 🤔
@hctiBelttiL
@hctiBelttiL 3 ай бұрын
@@herrpez the brackets are set before and after a block, anything you do in between is fair game. With whitespace you can easily lose track of scope if you fatfinger the wrong key, cat climbs on your keyboard, etc. Also, assume that you want to move or paste a block of code inside a different scope, you then have to adjust the indentation instead of simply pressing the hotkey for the format code option in your IDE. Refactoring - made hard, courtesy of whitespace. Also, maybe you have a huge expression that you want to divide between multiple lines, or a hardcoded string, Python has you jumping through hoops just to do a simple thing like that, and it's ugly to boot. Let me put it another way - In other languages code blocks are defined, and remain defined until that definition is acted upon. In Python code blocks define themselves, and that's a recipe for mistakes.
@Templarfreak
@Templarfreak 3 ай бұрын
@@herrpez the problem with using whitespace in the way python does is that it is virtually invisible, but absolutely crucial to running the code. if the amount of indents is not exactly the same between two lines of code, python will not like it. this basically forces you to use tabs or to have your code writing software to auto indent a specific number of spaces for you, and for that software to have some kind of visualization to easily tell how many spaces you have.
@herrpez
@herrpez 3 ай бұрын
@@Templarfreak Any half decent editor will automatically indent things correctly for you. It's honestly a struggle to screw up the code in the first place. And when you do, either the interpreter tells you, or the LSP (should you have one) does long before it even becomes an issue. As for using tabs... there's nothing wrong with it, but it is unusual. Nevertheless- no good editor, that I know, of lacks a setting to turn a tab press into any given number of spaces.
@davidlakubu9968
@davidlakubu9968 4 ай бұрын
Recently restarted using it ,I made a small tic tac toe in love2d and even added a min max ai all in one day, I even ended up using it for the backend with teal (the equivalent of typescript for Lua) of a personal project I had in mind for months (now I just need to find where I can host it 😂😂)
@awesome-coding
@awesome-coding 4 ай бұрын
Thanks for the love2d suggestion. Didn't know about it, but it looks really interesting.
@owdoogames
@owdoogames 2 ай бұрын
Love2D is… lovely. And so easy to pick up. I hadn’t really looked at it or Lua beyond a few basic tutorials before taking part in the official Love2D game jam in 2022, and I managed to make and complete a fairly complex clicker/godsim/puzzle game in 7 days, including making all the graphics from scratch. I came 21st out of 63 participants, which I count as a win for my first ever game jam using a language and framework I was learning as I took part! Unfortunately, I’ve not followed it up in my game dev hobby, and wandered back to Godot and then Unity. However, I’m considering switching to the lightweight Lua-based game engine Defold as it now offers free access to building for PlayStation & Nintendo Switch consoles :)
@hedgeearthridge6807
@hedgeearthridge6807 2 ай бұрын
The LuaTeX compiler allows you to use it in LaTeX. I don't know anything about Lua and I'm just as lost now as when i started the video, but it's still the best compiler even if you don't use Lua, along with XeTeX especially if you're writing in a language that's nothing like English, such as Arabic or Japanese.
@sewind6613
@sewind6613 13 күн бұрын
Very helpful. Thank you.
@awesome-coding
@awesome-coding 12 күн бұрын
Glad it was helpful!
@TheTwober
@TheTwober 3 ай бұрын
It's easy, fast, flexible, free, supports old and modern coding, and is compatible with about everything. What more could you possibly ask from a script language? If you work with Java then you have the option to use LuaJ, which is capable of compiling Lua code directly into JVM bytecode, so you get maximum performance after the JIT is done with it.
@JimJulian
@JimJulian 2 ай бұрын
This is very helpful. Thank you!
@awesome-coding
@awesome-coding 2 ай бұрын
You're very welcome!
@gregoireboux874
@gregoireboux874 3 ай бұрын
At 7:15, in this code example, is it normal Point struct definition contains integers but new_point function uses double number type ? Is that a mistake ? If yes, will it crash at compilation time, execution time ?
@Bunny99s
@Bunny99s 2 ай бұрын
Well, I actually looked it up (haven't tried it as my C days are a thing of the past). It seems C actually converts double automatically to int in this case. So in modern languages it would be an error and would require an explicit cast. In lua itself numbers are always doubles which can be a bit of a pain sometimes. Though a double can represent 32 bit integers without any issues. Only bitwise operations need a bit extra work. But there are usually libraries in lua that can handle that. I've actually seen many libraries written in pure lua. That includes zip, deflate and even SSL, AES and SHA.
@nikoladd
@nikoladd 3 ай бұрын
Lua is a lot like PHP, except lightweight and embeddable... and functional. Which basically makes it very good as a configuration scripting language as part of something important in your system that isn't dynamic ..like nginx.
@stuckfart
@stuckfart Ай бұрын
great video! thank you!
@awesome-coding
@awesome-coding Ай бұрын
Glad you liked it!
@dhuxdheerdahir2736
@dhuxdheerdahir2736 4 ай бұрын
Thank you!. fyi will use lua basics elements.
@awesome-coding
@awesome-coding 4 ай бұрын
Thank you!
@DizY_8
@DizY_8 4 ай бұрын
I seem to recall that Lua is used in Roblox? Might be another factor for its popularity?
@DizY_8
@DizY_8 4 ай бұрын
And Roblox is mentioned in the video. I should really watch the video before commenting...
@Devilhunter69
@Devilhunter69 4 ай бұрын
I think its the only major factor in its popularity lol
@estebanmurcia8451
@estebanmurcia8451 4 ай бұрын
It's also used in World of Warcraft and neovim so those two add to its popularity
@wlockuz4467
@wlockuz4467 4 ай бұрын
​@@Devilhunter69 You forgot GTA mods
@nullpointer1755
@nullpointer1755 4 ай бұрын
Lua is used by a lot of games, usually not being talked about too much. Really the most underestimated language of all time.
@fantastikam
@fantastikam 3 ай бұрын
Can you explain how you make the code images in these videos?
@awesome-coding
@awesome-coding 3 ай бұрын
Hey! I'm doing it using Photoshop & Adobe Premiere
@xman3336
@xman3336 15 күн бұрын
thank you man
@corepunch
@corepunch Ай бұрын
Great to see so much love for Lua as atm I’m trying to sell a Dashboard UI engine based on C+Lua to Mercedes
@awesome-coding
@awesome-coding Ай бұрын
You can do it!
@Epic_StoriesByPrit
@Epic_StoriesByPrit 3 ай бұрын
Is anyone know any reference for learning ....how to use lua for UI development along with javascript and html
@homerobaroni1655
@homerobaroni1655 3 ай бұрын
Fengari
@hammerheadcorvette4
@hammerheadcorvette4 3 ай бұрын
Warframe has been using Lua for over 10yrs. Soulframe is being developed and is using Lua in it's development.
@kneekoo
@kneekoo 3 ай бұрын
Another cool use case for Lua is writing games and mods for the Minetest game engine - the one AntVenom used to trick people into believing he was playing Minecraft. :)
@artemmelnik7965
@artemmelnik7965 2 ай бұрын
Lua + C is a pure magic, although calling lua from C is a minefield. Calling C from lua is much more fun - unless you want to read a lua table from the C code hehehe, good luck with this. And watch out for nils that pop up from every direction in a most unexpected moment. Nevertheless, it totally changed my outlook on software design, - just put all the logic into a lua script and use the native code as a glue.
@waltermelo1033
@waltermelo1033 3 ай бұрын
I wasn't expecting it at all.
@Solemn_Lemon
@Solemn_Lemon 3 ай бұрын
Man, where I could find those charts you was talking about?
@awesome-coding
@awesome-coding 3 ай бұрын
Hey! Check out state of the Octoverse - github.blog/2023-11-08-the-state-of-open-source-and-ai/ It discusses Lua's status in Open Source last year.
@Solemn_Lemon
@Solemn_Lemon 3 ай бұрын
@@awesome-coding Thank you very much!
@krccmsitp2884
@krccmsitp2884 3 ай бұрын
00:05 what's the source for the graph?
@awesome-coding
@awesome-coding 3 ай бұрын
State of the Octoverse - github.blog/2023-11-08-the-state-of-open-source-and-ai/
@krccmsitp2884
@krccmsitp2884 3 ай бұрын
@@awesome-coding thanks
@soft.developer
@soft.developer 3 ай бұрын
This language was created in brazil. I so proud of if
@Dexter101x
@Dexter101x 3 ай бұрын
I use a software that benefits from users using that. And I think that's the reason for its newfound popularity
@bearcb
@bearcb 2 ай бұрын
Lua was created at the Catholic University in Rio, Brazil. Lua means Moon in Portuguese.
@JaimeWarlock
@JaimeWarlock 3 ай бұрын
I have considered forking BAR (Beyond All Reason) to create a fantasy version of the game. Never did any research yet, so not sure how YT knew I might be interested in learning Lua though. Looks close enough to 'C' though that I should be proficient in it in just a few days.
@eduardmart1237
@eduardmart1237 4 ай бұрын
I think it is used in a lot of games. As a scripting language
@noname-zt2zk
@noname-zt2zk 4 ай бұрын
Is used for modding for games that werent made in unity or godot
@ZapOKill
@ZapOKill 3 ай бұрын
world of warcraft and minecraft plugins also heavily rely on lua
@MaximSchoemaker
@MaximSchoemaker 4 ай бұрын
Ty :)
@jackykoning
@jackykoning 2 ай бұрын
Lua is implemented into many games including World of Warcraft and Garry's Mod. Because you don't really have to be all that smart to read it it is quite easy to learn. Lighttpd also has a plugin to use Lua which makes certain tasks a lot easier to do. That is why Lua is so popular.
@nalcij
@nalcij 3 ай бұрын
Lua has Terra and WASM support. It’s incredibly fast when paired with Terra and C.
@waltermelo1033
@waltermelo1033 3 ай бұрын
fun fact, is that Lua is actually Moon in portuguese.
@rogeriopenna9014
@rogeriopenna9014 3 ай бұрын
@@waltermelo1033 well, it's even in the logo. And Terra also means Earth in Portuguese (before anyone thing it's Latin... well, it IS Latin, but also Portuguese)
@sakurascrolls
@sakurascrolls 3 ай бұрын
Been honest I did start dealing with lua like four or five years ago. All did start as a joke in my free time learning about how to write scripts in game guardian apk for android. It became so fun with the time, that I did start messing around on a daily base till the point, where did start hosting my own cheats, via my own mod of game guardian mixing lua with basic php. The best part of all is, that I am using just a phone.😂😂😂
@billkendrick1
@billkendrick1 Ай бұрын
The modern remake of "Defender" for the PlayStation 2 used lua!
@godstruthwar7410
@godstruthwar7410 3 ай бұрын
haha.. ran into lua a while back when looking into custom backend code for a 'fat-client app' leveraging it for its 'scripting' engine, nearly vomited, and successfully avoided returning to it until this week Now sitting down with it out of necessity...( all the while mumbling to myself and cursing it as a crusty old weekly-typed 'slanguage'...) and then I run into this video & see that impossible metrics chart... On the one hand, it evokes despair at the prospect I might have to use it one day for a paycheck On the other, GREAT to know I'm not completely wasting my time learning something for a one-off purpose. Signed, -Bash_Lova (oh the irony!) P.S. Thanks for breaking my heart, then healing it in the first 90s... P.S.S. Love the video edits: making the uber-dry... entertaining
@awesome-coding
@awesome-coding 3 ай бұрын
😂 Amazing comment!
@HaxxBlaster
@HaxxBlaster 2 ай бұрын
Lua was my first programming language! 17 years ago i created a drawing application for the PSP, there is a few demo videos on my channel if anyone wants to see.
@awesome-coding
@awesome-coding 2 ай бұрын
Nice!
@harryvpn1462
@harryvpn1462 23 күн бұрын
People underestimate how much of the Lua userbase is just roblox Luau devs, probably like 90%
@waltermelo1033
@waltermelo1033 3 ай бұрын
do anyone is using lua at Web? with HTMX maybe?
@YuriG03042
@YuriG03042 4 ай бұрын
I'm surprised at the large number of people commenting their assumed reasons for Lua's popularity, as if the channel owner actually wanted an answer. Did people never learn what a rhetorical question is? Great video, btw. Lua is the Brazilian language, so I'm proud that it exists despite never writing a single line of it.
@awesome-coding
@awesome-coding 4 ай бұрын
Lua is the second best thing that came out of Brazil :D
@snapphanen
@snapphanen 3 ай бұрын
You have a tendency to put important code under the KZbin captions
@awesome-coding
@awesome-coding 3 ай бұрын
Thanks for mentioning this. I'm never thinking about captions when editing a video, but you are making a great point. I'll keep it in mind moving forward.
@Iswimandrun
@Iswimandrun 3 ай бұрын
I Lua in my dreams at night wish I could get it out of my head but tables and meta tables with c interop is addictive.
@guilherme5094
@guilherme5094 3 ай бұрын
👍!
@fdwr
@fdwr 3 ай бұрын
The one core mistake in a Lua was starting tables shifted off-by-one by default, complicating all your math with extra +1's here and -1's there 🤦. Otherwise it's pretty great, and I'd prefer it over Python.
@wlockuz4467
@wlockuz4467 4 ай бұрын
Anyone old enough to remember using Lua as a scripting language for GTA games? 😄
@awesome-coding
@awesome-coding 4 ай бұрын
Anyone old enough to remember GTA games? GTA 5 is 10 years old btw. And SanAndreas (the one I played A LOT) is 20 years old 😑
@DezZolation
@DezZolation 4 ай бұрын
MTA ;)
@user-bz8qi6vu4q
@user-bz8qi6vu4q 4 ай бұрын
Redis and ScyllaDB stored procedures - but don't be to greedy : be aware of garbage collection costs.
@awesome-coding
@awesome-coding 4 ай бұрын
Thanks for mentioning Redis - I wasn't aware of that.
@oblivion_2852
@oblivion_2852 3 ай бұрын
Also beware of the stack. If you put too many things on it. It can get really slow whenever it has to reorder the stack
@markyip554
@markyip554 4 ай бұрын
Array and hash map in the same syntax... Remind me of php
@awesome-coding
@awesome-coding 4 ай бұрын
Ha! I didn't make the connection until now.
@cyrilemeka6987
@cyrilemeka6987 3 ай бұрын
4:41 "just as God intended"😂😂 is funny asf
@nospoiler9550
@nospoiler9550 3 ай бұрын
Why isn't Lua so popular? Well, the language was designed to be embedded and almost invisible to the application. Romantically, I think her not being popular kind of confirms her goal.
@KvapuJanjalia
@KvapuJanjalia 4 ай бұрын
I have written some WoW addons and plenty Redis scripts (both are Lua hosts), and developer experience is just horrible.
@awesome-coding
@awesome-coding 4 ай бұрын
Curious to find out why if you are willing to share :)
@Om4r37
@Om4r37 4 ай бұрын
@@awesome-codingI only wrote scripts in lua but I think there’s inconsistencies in indexing which makes you make a lot of off-by-one errors, native lua tables and lua libraries assume 1-based indexing but external libraries written in C for example assume 0-based indexing
@frityet2840
@frityet2840 4 ай бұрын
@@Om4r37the lua C API uses 1 based arrays when you pass them into a C function, so the dev would have to account for that anyways so it isn't really an issue
@plato4ek
@plato4ek 2 ай бұрын
6:35 you don't need to resume coroutines in a loop
@CharleyDonar
@CharleyDonar 3 ай бұрын
Lua forever!
@____uncompetative
@____uncompetative 2 ай бұрын
Surely you don't need the nil type when you have { }
@familyshare3724
@familyshare3724 3 ай бұрын
Why is Lua suddenly popular? #1 Neovim #2 see 1
@fcktom
@fcktom 4 ай бұрын
Lua good 🤓
@sinamobasheri
@sinamobasheri 2 ай бұрын
Lua is popular! Am I living in a alternative universe?
@G8tr1522
@G8tr1522 2 ай бұрын
i always have to re-learn how tf closures work
@awesome-coding
@awesome-coding 2 ай бұрын
😂
@Om4r37
@Om4r37 4 ай бұрын
I learned Lua because of AutoTouch (scriptable auto clicker for iOS)
@FaizKhan-of9qv
@FaizKhan-of9qv 4 ай бұрын
lua seems like sister of javascript
@Jonathan-rm6kt
@Jonathan-rm6kt 3 ай бұрын
4:43 "with indexes starting at 1, just as God intended" LOL😂
@awesome-coding
@awesome-coding 3 ай бұрын
I did 4 years of Pascal (which also starts from 1) in high school so all the languages starting from 0 are the ones being wrong in my opinion 😂
@gmdrandom6287
@gmdrandom6287 3 ай бұрын
1-based indexing is the only correct indexing
@Jonathan-rm6kt
@Jonathan-rm6kt 3 ай бұрын
​@@awesome-coding Ha, me too! I haven't thought of Pascal in years, since my first job out of school. That's definitely why I have this persistent aversion of it to this day :D
@tablettablete186
@tablettablete186 3 ай бұрын
​@@gmdrandom6287Based indexing!
@dytra_io
@dytra_io 4 ай бұрын
it's simply because of Roblox imagine you're a gamedev and you wanna make a multiplayer online game then you must buy some expensive server to be able to run the multiplayer features the answer is Roblox. you got the server,database,multiplayer features integrated in their IDE ,FOR FREE!! I mean which other company does gives you a production ready server !?
@universaltoons
@universaltoons 3 ай бұрын
roblox uses luau
@imdbere
@imdbere 4 ай бұрын
Computercraft!
@awesome-coding
@awesome-coding 4 ай бұрын
I had to search what this is 😅 I'm getting old...
@petermuller5088
@petermuller5088 3 ай бұрын
Nice video but please tone down on the meme displays and powerpoint fade ins. It makes your video look like a 80s cartoon network series at times.
@awesome-coding
@awesome-coding 3 ай бұрын
Thanks for the feedback!
@Redyf
@Redyf 3 ай бұрын
Index starts at 1 in lua 😭
@vytah
@vytah 3 ай бұрын
Don't forget xkcd 1102
@awesome-coding
@awesome-coding 3 ай бұрын
that's fair :)
@MadsonOnTheWeb
@MadsonOnTheWeb 3 ай бұрын
Lua does what Python dreams to do
@awesome-coding
@awesome-coding 3 ай бұрын
😂 nice
@MrTomas7777
@MrTomas7777 3 ай бұрын
Lua does what Python't
@messengercreator
@messengercreator 3 ай бұрын
print = "u ar the best this video" -- increase subscript " end
@awesome-coding
@awesome-coding 3 ай бұрын
Thank you!
@naranyala_dev
@naranyala_dev 4 ай бұрын
NEOVIM, NEOVIM, NEOVIM
@GaryChike
@GaryChike 3 ай бұрын
And then there are all the Lua variants - Luau(Roblox), MoonScript, Agena, etc..
@TechBuddy_
@TechBuddy_ 4 ай бұрын
neovim btw 😅
@id104335409
@id104335409 3 ай бұрын
First time I hear of it. Sigh... It never ends...
@LukasSmith827
@LukasSmith827 4 ай бұрын
print"because lua"
@awesome-coding
@awesome-coding 4 ай бұрын
😅
@esra_erimez
@esra_erimez 3 ай бұрын
I *love* Lua, I just wish indexes started at 0
@Cerbyo
@Cerbyo 2 ай бұрын
that's literally just a meme. if u spend enough time in lua u realize the benefits of starting at 1. the complaints 99% of the time come when porting algorithms into lua, since they all need to be rewritten and because there is no continue statement either u have to fundamentlly rewrite the entire algorithm...and there often is no support so u'll need to learn the entire algorithm and make ur own basically in lua.....thus many lua users endup with their own personal library of lua functions. Which could all be fixed via community support that doesn't exist like it does for every other language.
@Fiercesoulking
@Fiercesoulking 3 ай бұрын
Lua in web dev is true let let the LuaHerasy begin
@bonquaviusdingle5720
@bonquaviusdingle5720 2 ай бұрын
ah yes the top programming languages like SQL, makefile, and shell...
@awesome-coding
@awesome-coding 2 ай бұрын
You forgot HTML which is by far the most popular.
@PeterZaitcev
@PeterZaitcev 3 ай бұрын
- Why is Lua so popular? - It's not.
@JarppaGuru
@JarppaGuru 3 ай бұрын
bcoz its put everything. it just script. could be doine anything else even create yet again new something
@clarkd1955
@clarkd1955 3 ай бұрын
3 reasons Lua is so popular. Free, free and free. Not so complicated a reason.
@garethde-witt6433
@garethde-witt6433 2 ай бұрын
It’s so popular that no one has heard of it
@peterszarvas94
@peterszarvas94 4 ай бұрын
lua jit is fast
@Gruak7
@Gruak7 4 ай бұрын
Blazingly or just fast?
@apekz3592
@apekz3592 3 ай бұрын
​@@Gruak7Blazingly fast
@someguy9175
@someguy9175 19 күн бұрын
🇧🇷
Go is Surprisingly Easy
9:57
Awesome
Рет қаралды 53 М.
Why learn LUA?
6:24
Kodaps Academy
Рет қаралды 3,2 М.
小路飞姐姐居然让路飞小路飞都消失了#海贼王  #路飞
00:47
路飞与唐舞桐
Рет қаралды 89 МЛН
Не пей газировку у мамы в машине
00:28
Даша Боровик
Рет қаралды 9 МЛН
Pkl: Apple's New JSON/YAML Killer (I actually want to use this...)
14:30
The HATE Stack - Simple and Efficient
8:17
Awesome
Рет қаралды 48 М.
A Jr Dev For Life?? | Prime Reacts
21:33
ThePrimeTime
Рет қаралды 269 М.
The Ultimate Tier Programming Tier List | Prime Reacts
26:57
ThePrimeTime
Рет қаралды 289 М.
Running "Hello World!" in 10 FORBIDDEN Programming Languages
18:07
Embedding Lua in C++ #1
35:33
javidx9
Рет қаралды 171 М.
ChatGPT Can Now Talk Like a Human [Latest Updates]
22:21
ColdFusion
Рет қаралды 319 М.
NeovimConf 2022: Lua, a Primer
30:10
John McBride
Рет қаралды 14 М.
Now is The Best Time to Learn WebAssembly
8:00
Awesome
Рет қаралды 60 М.
Projects Every Programmer Should Try
16:58
ThePrimeTime
Рет қаралды 338 М.