Why Is Lua So Popular?

Поділитися
Вставка
  • Опубліковано 26 гру 2024

КОМЕНТАРІ •

  • @dameanvil
    @dameanvil 10 місяців тому +59

    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  10 місяців тому +7

      Thank you!

    • @hedwig7s
      @hedwig7s 28 днів тому +1

      Dude this reads like the readme of the latest "blazingly fast" javascript framework

  • @dkuppens5357
    @dkuppens5357 10 місяців тому +91

    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 10 місяців тому +2

      doing exactly this for work 20 years later :) We use LuaJIT for the FFI which makes C interop so damn simple.

  • @evccyr
    @evccyr 11 місяців тому +375

    Neovim plugins obviously

    • @CrazyLuke11
      @CrazyLuke11 11 місяців тому +6

      Yeah 😅

    • @vaisakh_km
      @vaisakh_km 11 місяців тому +16

      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 11 місяців тому +17

      Roblox is also very big

    • @universaltoons
      @universaltoons 10 місяців тому

      @@unendlicherping318 roblox uses luau

    • @MohaaAbdi
      @MohaaAbdi 10 місяців тому +2

      Good one😂

  • @spicybaguette7706
    @spicybaguette7706 11 місяців тому +191

    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  11 місяців тому +5

      Yep!

    • @pinatacolada7986
      @pinatacolada7986 11 місяців тому +12

      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 10 місяців тому +7

      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 10 місяців тому +1

      The point is where to use that knowledge. I learned it but i am not have any work that using Lua

    • @Bunny99s
      @Bunny99s 10 місяців тому

      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 ^^

  • @zulupox
    @zulupox 10 місяців тому +36

    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.

    • @Malidictus
      @Malidictus 6 місяців тому

      How is that easy to follow? A programme can just call a function out of the aether of global variables, but the call gives you absolutely no idea where it's actually defined. That strikes me as being impossible to follow.

    • @zulupox
      @zulupox 5 місяців тому

      @@Malidictus It is easy to follow since the language is tiny. There isn't a myriad different ways to implement things. That means that if you are looking at code from another programmer, it is easier to understand usually.
      For any larger scripting language code-base you need to be more strict with code Also only use Globals rarely in very specific cases. than if you have a typed language. Of course you will sometimes do a spelling mistake, and call something void. But those bugs are almost always trivial to find and fix...

  • @davidd355
    @davidd355 10 місяців тому +45

    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  10 місяців тому +5

      👏🏻👏🏻👏🏻

    • @rogeriopenna9014
      @rogeriopenna9014 10 місяців тому +14

      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 7 місяців тому +1

      que foda

  • @siriusleto3758
    @siriusleto3758 10 місяців тому +35

    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 10 місяців тому +4

      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 11 місяців тому +45

    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 11 місяців тому +6

      Operating system? IS this even possible? Tell me abt everything Im excited to know

    • @PamellaCardoso-pp5tr
      @PamellaCardoso-pp5tr 11 місяців тому +13

      ​@@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 11 місяців тому +4

      @@PamellaCardoso-pp5tr why isnt lua só famous RN like python etc

    • @Redyf
      @Redyf 10 місяців тому +20

      ​@@Chara556index starts at 1 🤣

    • @taihuynhuc3135
      @taihuynhuc3135 10 місяців тому

      @@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.

  • @Maxjoker98
    @Maxjoker98 9 місяців тому +5

    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).

    • @SirusStarTV
      @SirusStarTV Місяць тому

      I thought not having binary distribution was bad, but found it's so easy to compile it on windows.

  • @marcotrosi
    @marcotrosi 11 місяців тому +17

    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.

  • @anon_y_mousse
    @anon_y_mousse 10 місяців тому +20

    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 10 місяців тому +7

      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 8 місяців тому

      Neovim is better

    • @anon_y_mousse
      @anon_y_mousse 8 місяців тому

      @@gustavojoaquin_arch What's your empirical reasoning? Is it better defaults? If so, does that mean you do less configuration?

    • @gustavojoaquin_arch
      @gustavojoaquin_arch 8 місяців тому

      @@anon_y_mousse idk exactly how much is the difference in configuration options, but in neovim I find much more plugins than vim

  • @zekiz774
    @zekiz774 10 місяців тому +6

    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 10 місяців тому

      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.

  • @SRG-Learn-Code
    @SRG-Learn-Code 11 місяців тому +23

    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  11 місяців тому +3

      Interesting. I'm finding out Lua is available in way more games than I initially thought.

    • @SRG-Learn-Code
      @SRG-Learn-Code 11 місяців тому +3

      @@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 11 місяців тому +11

      Lua isn't an acronym, it's the Portuguese word for moon

    • @SRG-Learn-Code
      @SRG-Learn-Code 11 місяців тому +4

      @@Mark-kt5mh Mmm, like the luna, interesting.

    • @herrpez
      @herrpez 10 місяців тому +3

      @@SRG-Learn-Code Exactly like luna; they share the same etymological roots!

  • @ShakilShahadat
    @ShakilShahadat 11 місяців тому +10

    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 10 місяців тому +4

      "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 10 місяців тому +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 10 місяців тому

      @@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 10 місяців тому

      @@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 10 місяців тому

      @@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.

  • @joaopauloalbq
    @joaopauloalbq 10 місяців тому +7

    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 🤯

  • @gabrieljose7041
    @gabrieljose7041 11 місяців тому +11

    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 9 місяців тому +1

      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

  • @johnp.johnson1541
    @johnp.johnson1541 2 місяці тому

    Well done! This video lays out right the language and in under 10 minutes.

  • @crism8868
    @crism8868 11 місяців тому +4

    Your videos are quick and straight to the point while still easy to follow along, subscribed!

    • @awesome-coding
      @awesome-coding  11 місяців тому +1

      Thank you! I really appreciate it!

  • @andreroodt4647
    @andreroodt4647 11 місяців тому +8

    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  11 місяців тому +1

      Interesting! Thanks for your input!

    • @BosonCollider
      @BosonCollider 9 місяців тому +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.

  • @Templarfreak
    @Templarfreak 10 місяців тому +12

    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.

  • @rogeriopenna9014
    @rogeriopenna9014 10 місяців тому +10

    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 9 місяців тому

      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

    • @johnp.johnson1541
      @johnp.johnson1541 2 місяці тому +2

      Unless one is using a syntactic sugar language over op codes, e.g., C, 0-based indexing NEVER makes sense or would be a valid design decision.
      C is a RAM level language and is designed around partitioning RAM to manage a state machine.
      Interpreted languages abstract away all of that. The goal should be problem-solving and not computer programming.
      We count by 1 from 1. We list by 1 from 1. We count and list to solve problems.

  • @hedgeearthridge6807
    @hedgeearthridge6807 9 місяців тому +1

    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.

  • @juansalvadordomandl5287
    @juansalvadordomandl5287 6 місяців тому +1

    Made a full game with lua, but this cleared somethings.

  • @jongeduard
    @jongeduard 11 місяців тому +7

    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 10 місяців тому +5

      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 10 місяців тому +5

      ​@@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 10 місяців тому

      To me (and some others) it's basically Scheme with Pascal syntax.

  • @hammerheadcorvette4
    @hammerheadcorvette4 10 місяців тому +3

    Warframe has been using Lua for over 10yrs. Soulframe is being developed and is using Lua in it's development.

  • @ohdarlin692
    @ohdarlin692 4 місяці тому

    lovely video montage makes it enjoyable to learn new information by watching your video ❤

  • @CEOofGameDev
    @CEOofGameDev 11 місяців тому +19

    I think Lua is popular due to it's inherit Brazilian charisma. Same thing as Elixir...

  • @avishevin1976
    @avishevin1976 10 місяців тому +9

    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.

  • @someDudeOnYtb
    @someDudeOnYtb 11 місяців тому +10

    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  11 місяців тому +4

      Thanks for the love2d suggestion. Didn't know about it, but it looks really interesting.

    • @owdoogames
      @owdoogames 10 місяців тому +1

      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 :)

  • @DizY_8
    @DizY_8 11 місяців тому +11

    I seem to recall that Lua is used in Roblox? Might be another factor for its popularity?

    • @DizY_8
      @DizY_8 11 місяців тому +14

      And Roblox is mentioned in the video. I should really watch the video before commenting...

    • @Devilhunter69
      @Devilhunter69 11 місяців тому +1

      I think its the only major factor in its popularity lol

    • @estebanmurcia8451
      @estebanmurcia8451 11 місяців тому +1

      It's also used in World of Warcraft and neovim so those two add to its popularity

    • @wlockuz4467
      @wlockuz4467 11 місяців тому +1

      ​@@Devilhunter69 You forgot GTA mods

    • @nullpointer1755
      @nullpointer1755 11 місяців тому +5

      Lua is used by a lot of games, usually not being talked about too much. Really the most underestimated language of all time.

  • @sewind6613
    @sewind6613 7 місяців тому +1

    Very helpful. Thank you.

  • @corepunch
    @corepunch 8 місяців тому +1

    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

  • @jimjulian
    @jimjulian 10 місяців тому

    This is very helpful. Thank you!

  • @kneekoo
    @kneekoo 10 місяців тому +1

    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. :)

  • @nikoladd
    @nikoladd 10 місяців тому +2

    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.

  • @TheTwober
    @TheTwober 10 місяців тому +1

    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.

  • @Jaybearno
    @Jaybearno 10 місяців тому +4

    4:43 "with indexes starting at 1, just as God intended" LOL😂

    • @awesome-coding
      @awesome-coding  10 місяців тому +1

      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 10 місяців тому +1

      1-based indexing is the only correct indexing

    • @Jaybearno
      @Jaybearno 10 місяців тому

      ​@@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 10 місяців тому

      ​@@gmdrandom6287Based indexing!

  • @SianaGearz
    @SianaGearz 10 місяців тому +4

    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  10 місяців тому

      😅

    • @waltermelo1033
      @waltermelo1033 10 місяців тому

      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 10 місяців тому +1

      Remind yourself never to mess around with Smalltalk then. (Smalltalk arrays too are origin 1.)

    • @SianaGearz
      @SianaGearz 10 місяців тому

      @@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.

  • @stuckfart
    @stuckfart 8 місяців тому

    great video! thank you!

  • @gregoireboux874
    @gregoireboux874 10 місяців тому

    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 10 місяців тому

      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.

  • @eduardmart1237
    @eduardmart1237 11 місяців тому +4

    I think it is used in a lot of games. As a scripting language

    • @noname-zt2zk
      @noname-zt2zk 11 місяців тому +2

      Is used for modding for games that werent made in unity or godot

    • @ZapOKill
      @ZapOKill 10 місяців тому

      world of warcraft and minecraft plugins also heavily rely on lua

  • @nalcij
    @nalcij 10 місяців тому +1

    Lua has Terra and WASM support. It’s incredibly fast when paired with Terra and C.

    • @waltermelo1033
      @waltermelo1033 10 місяців тому

      fun fact, is that Lua is actually Moon in portuguese.

    • @rogeriopenna9014
      @rogeriopenna9014 10 місяців тому

      @@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)

  • @waltermelo1033
    @waltermelo1033 10 місяців тому

    I wasn't expecting it at all.

  • @fantastikam
    @fantastikam 10 місяців тому

    Can you explain how you make the code images in these videos?

    • @awesome-coding
      @awesome-coding  10 місяців тому

      Hey! I'm doing it using Photoshop & Adobe Premiere

  • @XajiDahir
    @XajiDahir 11 місяців тому +1

    Thank you!. fyi will use lua basics elements.

  • @Solemn_Lemon
    @Solemn_Lemon 10 місяців тому

    Man, where I could find those charts you was talking about?

    • @awesome-coding
      @awesome-coding  10 місяців тому +1

      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 10 місяців тому

      @@awesome-coding Thank you very much!

  • @jackykoning
    @jackykoning 10 місяців тому

    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.

  • @Dexter101x
    @Dexter101x 11 місяців тому

    I use a software that benefits from users using that. And I think that's the reason for its newfound popularity

  • @Epic_StoriesByPrit
    @Epic_StoriesByPrit 11 місяців тому +1

    Is anyone know any reference for learning ....how to use lua for UI development along with javascript and html

  • @soft.developer
    @soft.developer 10 місяців тому +1

    This language was created in brazil. I so proud of if

  • @krccmsitp2884
    @krccmsitp2884 10 місяців тому

    00:05 what's the source for the graph?

    • @awesome-coding
      @awesome-coding  10 місяців тому +1

      State of the Octoverse - github.blog/2023-11-08-the-state-of-open-source-and-ai/

    • @krccmsitp2884
      @krccmsitp2884 10 місяців тому

      @@awesome-coding thanks

  • @bearcb
    @bearcb 9 місяців тому

    Lua was created at the Catholic University in Rio, Brazil. Lua means Moon in Portuguese.

  • @cariyaputta
    @cariyaputta 5 місяців тому

    In Lua, index starts from one.

  • @harryvpn1462
    @harryvpn1462 8 місяців тому +1

    People underestimate how much of the Lua userbase is just roblox Luau devs, probably like 90%

  • @xman3336
    @xman3336 7 місяців тому +1

    thank you man

  • @andreaselfving2787
    @andreaselfving2787 3 місяці тому

    Qt creator now also has lua support for plugins

  • @artemmelnik7965
    @artemmelnik7965 9 місяців тому +1

    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.

  • @HaxxBlaster
    @HaxxBlaster 10 місяців тому

    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.

  • @billkendrick1
    @billkendrick1 9 місяців тому

    The modern remake of "Defender" for the PlayStation 2 used lua!

  • @ET-ITchannel
    @ET-ITchannel 6 місяців тому

    EP2: Introduction of Lua | Programming
    ua-cam.com/users/liveAW8s8iugADs?feature=share

  • @snapphanen
    @snapphanen 10 місяців тому +1

    You have a tendency to put important code under the UA-cam captions

    • @awesome-coding
      @awesome-coding  10 місяців тому

      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.

  • @user-bz8qi6vu4q
    @user-bz8qi6vu4q 11 місяців тому +1

    Redis and ScyllaDB stored procedures - but don't be to greedy : be aware of garbage collection costs.

    • @awesome-coding
      @awesome-coding  11 місяців тому

      Thanks for mentioning Redis - I wasn't aware of that.

    • @oblivion_2852
      @oblivion_2852 10 місяців тому

      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

  • @scullyy
    @scullyy 5 місяців тому +1

    why not make local the default ?

    • @awesome-coding
      @awesome-coding  5 місяців тому

      good question

    • @scullyy
      @scullyy 5 місяців тому +1

      @@awesome-coding Here's the answer from the man himself:
      "This is a very funny question, because if you think about any programming language, but Python, they are all kind of non-local by default. For instance, if you see a function in C, you don't see the whole code, because there are a lot of 'includes' there. So you see one function, and if a variable is not declared in the function, it is global by default. That's what happens in C; that's what happens in Java. That's what happens in a lot of programming languages. So I think it's funny that people learn Python and then come to Lua and say "Oh, Lua is non-local" and think we invented that, that it was something completely radical. And there are so many wrong things with local by default because you cannot define the scope you want the variable to be. It's very common. For instance, you have a variable that you must initialize inside a 'then' or an 'else' in an 'if,' so if it's local by block, it would be restricted to the block inside the 'if' so otherwise you only have locals and in the function scope, which is not good, too. So it's much nicer to have local. You can have a local that is really local to the block where you need it. The standard in programming languages is not local by default. So Python created that slice for some very small things, but for anything more complex, you start to get problems around that. I can understand the question and it's reasonable to ask why do we have non-local as default, that is not to accept undeclared variables and all variables should be declared. Having the option of local by default, for me, is something very strange."

  • @JaimeWarlock
    @JaimeWarlock 10 місяців тому

    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.

  • @KvapuJanjalia
    @KvapuJanjalia 11 місяців тому +2

    I have written some WoW addons and plenty Redis scripts (both are Lua hosts), and developer experience is just horrible.

    • @awesome-coding
      @awesome-coding  11 місяців тому +1

      Curious to find out why if you are willing to share :)

    • @Om4r37
      @Om4r37 11 місяців тому

      @@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 11 місяців тому +1

      @@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

  • @cyrilemeka6987
    @cyrilemeka6987 10 місяців тому

    4:41 "just as God intended"😂😂 is funny asf

  • @wlockuz4467
    @wlockuz4467 11 місяців тому +5

    Anyone old enough to remember using Lua as a scripting language for GTA games? 😄

    • @awesome-coding
      @awesome-coding  11 місяців тому +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 11 місяців тому +1

      MTA ;)

  • @bonquaviusdingle5720
    @bonquaviusdingle5720 9 місяців тому +1

    ah yes the top programming languages like SQL, makefile, and shell...

    • @awesome-coding
      @awesome-coding  9 місяців тому

      You forgot HTML which is by far the most popular.

  • @YuriG03042
    @YuriG03042 11 місяців тому +3

    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  11 місяців тому

      Lua is the second best thing that came out of Brazil :D

  • @JonahTheWhite
    @JonahTheWhite 2 місяці тому

    How can you mention it's embedded in Roblox and not WoW?

  • @godstruthwar7410
    @godstruthwar7410 10 місяців тому

    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

  • @sinamobasheri
    @sinamobasheri 10 місяців тому

    Lua is popular! Am I living in a alternative universe?

  • @Iswimandrun
    @Iswimandrun 10 місяців тому

    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.

  • @G8tr1522
    @G8tr1522 9 місяців тому

    i always have to re-learn how tf closures work

  • @petermuller5088
    @petermuller5088 10 місяців тому

    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.

  • @rikhardfsoss
    @rikhardfsoss 5 місяців тому

    awesomewm :D

  • @messengercreator
    @messengercreator 10 місяців тому

    print = "u ar the best this video"
    -- increase subscript "
    end

  • @plato4ek
    @plato4ek 9 місяців тому

    6:35 you don't need to resume coroutines in a loop

  • @____uncompetative
    @____uncompetative 10 місяців тому

    Surely you don't need the nil type when you have { }

  • @madson-web
    @madson-web 10 місяців тому +1

    Lua does what Python dreams to do

  • @fdwr
    @fdwr 10 місяців тому

    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.

    • @Populous3Tutorials
      @Populous3Tutorials Місяць тому

      not a mistake, but a quality that most other languages lack

  • @nospoiler9550
    @nospoiler9550 10 місяців тому +1

    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.

  • @GaryChike
    @GaryChike 10 місяців тому

    And then there are all the Lua variants - Luau(Roblox), MoonScript, Agena, etc..

  • @vytah
    @vytah 10 місяців тому

    Don't forget xkcd 1102

  • @waltermelo1033
    @waltermelo1033 10 місяців тому

    do anyone is using lua at Web?
    with HTMX maybe?

  • @Om4r37
    @Om4r37 11 місяців тому

    I learned Lua because of AutoTouch (scriptable auto clicker for iOS)

  • @FaizKhan-of9qv
    @FaizKhan-of9qv 11 місяців тому

    lua seems like sister of javascript

  • @Fiercesoulking
    @Fiercesoulking 10 місяців тому

    Lua in web dev is true let let the LuaHerasy begin

  • @fieldmojo5304
    @fieldmojo5304 10 місяців тому +6

    Roblox kids growing up

  • @carlosdumbratzen6332
    @carlosdumbratzen6332 3 місяці тому

    I learned lua through computercraft.

  • @MaximSchoemaker
    @MaximSchoemaker 11 місяців тому

    Ty :)

  • @Redyf
    @Redyf 10 місяців тому

    Index starts at 1 in lua 😭

  • @id104335409
    @id104335409 10 місяців тому

    First time I hear of it. Sigh... It never ends...

  • @markyip554
    @markyip554 11 місяців тому

    Array and hash map in the same syntax...
    Remind me of php

    • @awesome-coding
      @awesome-coding  11 місяців тому +2

      Ha! I didn't make the connection until now.

  • @imdbere
    @imdbere 11 місяців тому +2

    Computercraft!

    • @awesome-coding
      @awesome-coding  11 місяців тому +1

      I had to search what this is 😅 I'm getting old...

  • @CharleyDonar
    @CharleyDonar 10 місяців тому

    Lua forever!

  • @Cool-Linux-Penguin
    @Cool-Linux-Penguin 5 місяців тому

    Takes 20 minutes to learn lua. But Roblox has its own language "Luau" and luau makes Lua feel like hell.

  • @clarkd1955
    @clarkd1955 10 місяців тому

    3 reasons Lua is so popular. Free, free and free. Not so complicated a reason.

  • @mikelyons5632
    @mikelyons5632 10 місяців тому +1

    Umm... no. The rate of growth of a language does NOT mean it's popular. If something goes from one person using it to TWO people using it, it's popularity DOUBLES!! But that don't make it popular.

  • @garethde-witt6433
    @garethde-witt6433 10 місяців тому

    It’s so popular that no one has heard of it