lua a fast multi-paradigm scripting
language famous for being so underrated
imagine a language that's easier to
learn than python while also being
faster and more portable than python lua
was named after the moon when it was
designed by a team of computer
scientists in brazil in 1993 it's
lightweight and extremely fast because
its virtual machine maps very closely to
c and when used with its just-in-time
compiler it's widely considered the
fastest scripting language in the world
this makes it ideal for embedding into
other applications like world of
warcraft or roblox for example where
users can write lua to build their own
games and features because the language
is embedded into the base game it's easy
to learn because it has only 21 reserved
words and has only one data structuring
mechanism called a table that can
represent arrays dictionaries graphs
trees and more it also supports
collaborative multitasking with
co-routines its standard library is very
minimal but it does have a large
ecosystem of packages with the lua rocks
package manager to get started install
it then create a file ending in.lua
declare a variable by providing a name
and value by default variables are
global but make them local with the
local keyword it's a dynamic language so
no type annotations are required we can
then use print to output the value to
the standard output there are no classes
in lua but anything you can imagine can
be done with functions and tables a
function is declared with the function
keyword then closed with the end keyword
functions are first class objects which
means they can be passed around to other
functions to support functional
programming patterns now to structure
data you create tables with braces a
table is actually an associative array
which means the index in the array can
be replaced with different values by
default it uses integer values and the
craziest thing about this language is
that it starts the index at 1 instead of
0 like most languages that gives us a
conventional array but we can also
easily create a dictionary by giving the
keys a string value now we can use 4 to
loop over every key value pair in the
table the language is single threaded
but we can use coroutines to pause and
resume a function create a co-routine
then use yield to suspend its execution
now somewhere else in the code use
co-routine resume to continue execution
until you get to the return statement
now if you're a c programmer you'll be
happy to know that lua has a very simple
c api it allows us to run lua code
inside a c program or vice versa run c
code from a lua program now to execute
your code open up the terminal and run
the lua interpreter this has been lua in
100 seconds hit the like button and
subscribe if you want to see more short
videos like this thanks for watching and
i will see you in the next one Watch Video Below For More...:https://youtu.be/jUuqBZwwkQw
Thanks For Reading, Don't Forget To Like And Comment On This Post 💕