Why learn LUA?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
why learn Lua what is Lu what is its purpose why was it created what are its strengths and weaknesses what is it Ed for and under what conditions might it be a good idea to learn it and conversely when is it not useful we'll be covering all this and more but first let me tell you a little story hi I'm David and I taught myself blure in 2007 I've been using it for over a decade I was working on a city Builder game called cities Excel the core game engine was in C++ and we selected lure as the glue between the user interface and the C++ engine and I fell in love with lu because it was so fun why was it fun well the reason behind that and the reason why we chose Lu as a scripting engine is related to the purpose behind Lu's creation so what is Lu and why was it created Lu was never designed to be a standalone language it's an extension language the creators aimed to design a simple portable versatile scripting language it's written as a C library which means it's both portable and performant it has a low footprint the full reference interpreter is only about 247 kiloby compiled we'll explore Louis features in detail in a second but before that the performance the low footprint and the portability make it ideal for scripting video games where extensibility is Key Roblox on World of Warcraft and the solo 2D mobile game engine are prime examples of this Lu is also a natural fit for more serious environments where you need to extend a core Behavior while still maintaining performance for example redis the in memory database allows you to use lure to run business logic inside the database itself neovim allows you to use l to customize how the editor works now are there any other reasons why these tools chose L what are L's other strengths well as I mentioned L is simple and easy to learn it only has 21 reserved keywords which means it's easy to master the syntax you can easily guess what most keywords do even if you don't know any lure for example an if statement will look something like this with a then and an else to delimit the block and an N to close it as you can see you use keywords to Define blocks not curly brackets or significant white space and semicolons are mostly optional there are also eight types in Lu the values can take we have basic types such as nil and Boolean and number and string and function and there's a single data structure called tables now you might think that this Simplicity means there isn't much that the language can do after all L doesn't explicitly provide classes or inheritance however as I mentioned lure is powerful and versatile but why is it versatile how does it Implement that versatility well in a sense everything lure resolves around tables if you want to name space your code you wrap it in a table if you want to create a set or a list or a hashmap you use a table you see L is a multi Paradigm language L only provides a few features but those features are powerful you can use them to build language features to fit your problem or your style and this means that L may be simple to learn but it's difficult to master let's take an example out of the box L doesn't provide classes or inheritance but you can build them with tables how can you do that well L provides a mechanism that allows you to change how the language itself Works more specifically you can attach a table to any value and that table allows you to override the default behavior of the value within the language this attached table is called a meta table for example you can't normally execute a table as if it was a function if I create a table called Tab and execute it Lu will complain that tab is not a function so far so good however if you create a table here I've called it metat tab which contains an underscore _ call function here in my function I just print out a message and I attach meta tab as tab's meta table the function in metat tab will be executed whenever the table is called as if it were a function now that's just an example in the same way you can't normally make data private within a table however you can override how a table's data is read and written by defining the underscore uncore index andore uncore new index on a meta table that's attached to the table you can't normally add or compare two tables but you can Define the underscore uncore add and underscore uncore EQ values of a meta table to Define how the two tables should be added and compared now can you see how those different overrides can help us create classes and inheritance it's almost as if you can program the behavior of the language itself now this makes L particularly interesting if you want to get a Hands-On knowledge of the inner workings of language constructs but does l have any weaknesses or to phrase things differently when do not bother learning L its main weakness perhaps is by Design L isn't a standalone language you can't create anything from lure only I've created tons of applications using lure and solo 2D but the core game engine the part doing the actual rendering to the screen wasn't written in lure this also means that outside of the video games industry there aren't many jobs available where lure is a requisite and even in the video games industry the trend is to use dialects of python which is more widely known so don't bother trying to build your career on Lu so why should you learn Lu well there are three main reasons to learn Lu first as I mentioned Lou is ideal if you want to learn programming but don't want to make a career of it or don't want to spend time learning syntax second if you want to extend what someone else has built where they've provided lure bindings this is the route that no the text editor has taken it's also how Roblox works and if you're working with reddis L can make your life much easier finally if you want to explore computer science Concepts such as classes recursiveness or functional programming L is a great way to try and build your version of that behavior because you can adapt how the language works and there's a fourth bonus reason because of the way L's designed I find it fun to use so let me know in the comments what you think of the language if you tried it out and I'll see you in the next video
Info
Channel: Kodaps Academy
Views: 7,071
Rating: undefined out of 5
Keywords: learn lua, Lua programming, Lua scripting language, Lua in gaming, Lua for beginners, Lua tutorial, Lua game development, Lua vs Python, Lua metatables, Lua classes, Lua inheritance, programming concepts with Lua, Lua versatility, Lua simplicity, Lua strengths and weaknesses, Lua in Redis, Lua in Neovim, Lua in Roblox, Lua programming basics, Lua language features, Lua script examples, Lua coding, Lua software development, Lua programming guide, Lua programming jobs
Id: I_rzFahRFeE
Channel Id: undefined
Length: 6min 24sec (384 seconds)
Published: Fri Mar 08 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.