Why Is Lua So Popular?

preview_player
Показать описание
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.

📚 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
Рекомендации по теме
Комментарии
Автор

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.

dameanvil
Автор

Lua is so simple that, presuming you have some programming experience, you can learn the basics in a couple of hours

spicybaguette
Автор

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.

dkuppens
Автор

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!

davidd
Автор

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.

zulupox
Автор

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

siriusleto
Автор

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

rogeriopenna
Автор

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

frityet
Автор

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.

marcotrosi
Автор

while Lua's standard library is quite small, it's quite easy to implement a lot of different libraries, and there is a 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.

Templarfreak
Автор

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.

avishevin
Автор

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.

SRG-Learn-Code
Автор

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.

anon_y_mousse
Автор

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

Maxjoker
Автор

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 🤯

joaopauloalbq
Автор

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

CEOofGameDev
Автор

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

gabrieljose
Автор

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.

zekiz
Автор

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.

andreroodt
Автор

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.

ShakilShahadat