<s>
Lua	B-Language
(	O
;	O
from	O
meaning	O
moon	O
)	O
is	O
a	O
lightweight	B-Language
,	O
high-level	B-Language
,	O
multi-paradigm	O
programming	O
language	O
designed	O
primarily	O
for	O
embedded	B-Language
use	I-Language
in	O
applications	O
.	O
</s>
<s>
Lua	B-Language
is	O
cross-platform	B-Operating_System
,	O
since	O
the	O
interpreter	B-Application
of	O
compiled	B-Language
bytecode	O
is	O
written	O
in	O
ANSI	O
C	B-Language
,	O
and	O
Lua	B-Language
has	O
a	O
relatively	O
simple	O
C	B-Language
API	B-Application
to	O
embed	O
it	O
into	O
applications	O
.	O
</s>
<s>
Lua	B-Language
originated	O
in	O
1993	O
as	O
a	O
language	O
for	O
extending	O
software	B-Application
applications	I-Application
to	O
meet	O
the	O
increasing	O
demand	O
for	O
customization	O
at	O
the	O
time	O
.	O
</s>
<s>
It	O
provided	O
the	O
basic	O
facilities	O
of	O
most	O
procedural	B-Application
programming	I-Application
languages	I-Application
,	O
but	O
more	O
complicated	O
or	O
domain-specific	B-Language
features	O
were	O
not	O
included	O
;	O
rather	O
,	O
it	O
included	O
mechanisms	O
for	O
extending	O
the	O
language	O
,	O
allowing	O
programmers	O
to	O
implement	O
such	O
features	O
.	O
</s>
<s>
As	O
Lua	B-Language
was	O
intended	O
to	O
be	O
a	O
general	O
embeddable	O
extension	B-Language
language	I-Language
,	O
the	O
designers	O
of	O
Lua	B-Language
focused	O
on	O
improving	O
its	O
speed	O
,	O
portability	O
,	O
extensibility	O
,	O
and	O
ease-of-use	O
in	O
development	O
.	O
</s>
<s>
Lua	B-Language
was	O
created	O
in	O
1993	O
by	O
Roberto	O
Ierusalimschy	O
,	O
Luiz	O
Henrique	O
de	O
Figueiredo	O
,	O
and	O
Waldemar	O
Celes	O
,	O
members	O
of	O
the	O
Computer	O
Graphics	O
Technology	O
Group	O
(	O
Tecgraf	O
)	O
at	O
the	O
Pontifical	O
Catholic	O
University	O
of	O
Rio	O
de	O
Janeiro	O
,	O
in	O
Brazil	O
.	O
</s>
<s>
Lua	B-Language
's	O
predecessors	O
were	O
the	O
data-description/configuration	O
languages	O
SOL	O
(	O
Simple	O
Object	O
Language	O
)	O
and	O
DEL	O
(	O
data-entry	O
language	O
)	O
.	O
</s>
<s>
In	O
The	O
Evolution	O
of	O
Lua	B-Language
,	O
the	O
language	O
's	O
authors	O
wrote	O
:	O
</s>
<s>
Lua	B-Language
1.0	O
was	O
designed	O
in	O
such	O
a	O
way	O
that	O
its	O
object	O
constructors	O
,	O
being	O
then	O
slightly	O
different	O
from	O
the	O
current	O
light	B-Language
and	O
flexible	O
style	O
,	O
incorporated	O
the	O
data-description	O
syntax	O
of	O
SOL	O
(	O
hence	O
the	O
name	O
Lua	B-Language
:	O
Sol	O
meaning	O
"	O
Sun	O
"	O
in	O
Portuguese	O
,	O
and	O
Lua	B-Language
meaning	O
"	O
Moon	O
"	O
)	O
.	O
</s>
<s>
Lua	B-Language
syntax	O
for	O
control	O
structures	O
was	O
mostly	O
borrowed	O
from	O
Modula	B-Language
(	O
if	O
,	O
while	O
,	O
repeat/until	O
)	O
,	O
but	O
also	O
had	O
taken	O
influence	O
from	O
CLU	B-Language
(	O
multiple	O
assignments	O
and	O
multiple	O
returns	O
from	O
function	O
calls	O
,	O
as	O
a	O
simpler	O
alternative	O
to	O
reference	O
parameters	O
or	O
explicit	O
pointers	O
)	O
,	O
C++	B-Language
(	O
"	O
neat	O
idea	O
of	O
allowing	O
a	O
local	O
variable	O
to	O
be	O
declared	O
only	O
where	O
we	O
need	O
it	O
"	O
)	O
,	O
SNOBOL	B-Application
and	O
AWK	B-Application
(	O
associative	B-Application
arrays	I-Application
)	O
.	O
</s>
<s>
In	O
an	O
article	O
published	O
in	O
Dr.	O
Dobb	O
's	O
Journal	O
,	O
Lua	B-Language
's	O
creators	O
also	O
state	O
that	O
LISP	B-Language
and	O
Scheme	B-Language
with	O
their	O
single	O
,	O
ubiquitous	O
data-structure	O
mechanism	O
(	O
the	O
list	O
)	O
were	O
a	O
major	O
influence	O
on	O
their	O
decision	O
to	O
develop	O
the	O
table	O
as	O
the	O
primary	O
data	O
structure	B-Language
of	O
Lua	B-Language
.	O
</s>
<s>
Lua	B-Language
semantics	B-Application
have	O
been	O
increasingly	O
influenced	O
by	O
Scheme	B-Language
over	O
time	O
,	O
especially	O
with	O
the	O
introduction	O
of	O
anonymous	B-General_Concept
functions	I-General_Concept
and	O
full	O
lexical	O
scoping	O
.	O
</s>
<s>
Several	O
features	O
were	O
added	O
in	O
new	O
Lua	B-Language
versions	O
.	O
</s>
<s>
Versions	O
of	O
Lua	B-Language
prior	O
to	O
version	O
5.0	O
were	O
released	O
under	O
a	O
license	O
similar	O
to	O
the	O
BSD	B-Operating_System
license	I-Operating_System
.	O
</s>
<s>
From	O
version	O
5.0	O
onwards	O
,	O
Lua	B-Language
has	O
been	O
licensed	O
under	O
the	B-License
MIT	I-License
License	I-License
.	O
</s>
<s>
Both	O
are	O
permissive	B-License
free	I-License
software	I-License
licences	I-License
and	O
are	O
almost	O
identical	O
.	O
</s>
<s>
Lua	B-Language
is	O
commonly	O
described	O
as	O
a	O
"	O
multi-paradigm	O
"	O
language	O
,	O
providing	O
a	O
small	O
set	O
of	O
general	O
features	O
that	O
can	O
be	O
extended	O
to	O
fit	O
different	O
problem	O
types	O
.	O
</s>
<s>
Lua	B-Language
does	O
not	O
contain	O
explicit	O
support	O
for	O
inheritance	B-Language
,	O
but	O
allows	O
it	O
to	O
be	O
implemented	O
with	O
metatables	O
.	O
</s>
<s>
Similarly	O
,	O
Lua	B-Language
allows	O
programmers	O
to	O
implement	O
namespaces	O
,	O
classes	O
,	O
and	O
other	O
related	O
features	O
using	O
its	O
single	O
table	O
implementation	O
;	O
first-class	B-Application
functions	I-Application
allow	O
the	O
employment	O
of	O
many	O
techniques	O
from	O
functional	B-Language
programming	I-Language
;	O
and	O
full	O
lexical	O
scoping	O
allows	O
fine-grained	O
information	B-Application
hiding	I-Application
to	O
enforce	O
the	O
principle	O
of	O
least	O
privilege	O
.	O
</s>
<s>
In	O
general	O
,	O
Lua	B-Language
strives	O
to	O
provide	O
simple	O
,	O
flexible	O
meta-features	B-Application
that	O
can	O
be	O
extended	O
as	O
needed	O
,	O
rather	O
than	O
supply	O
a	O
feature-set	O
specific	O
to	O
one	O
programming	O
paradigm	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
the	O
base	O
language	O
is	O
light	B-Language
—	O
the	O
full	O
reference	O
interpreter	B-Application
is	O
only	O
about	O
247kB	O
compiled	B-Language
—	O
and	O
easily	O
adaptable	O
to	O
a	O
broad	O
range	O
of	O
applications	O
.	O
</s>
<s>
A	O
dynamically	O
typed	O
language	O
intended	O
for	O
use	O
as	O
an	O
extension	B-Language
language	I-Language
or	O
scripting	B-Language
language	I-Language
,	O
Lua	B-Language
is	O
compact	O
enough	O
to	O
fit	O
on	O
a	O
variety	O
of	O
host	O
platforms	O
.	O
</s>
<s>
It	O
supports	O
only	O
a	O
small	O
number	O
of	O
atomic	O
data	O
structures	O
such	O
as	O
boolean	O
values	O
,	O
numbers	O
(	O
double-precision	O
floating	B-Algorithm
point	I-Algorithm
and	O
64-bit	O
integers	O
by	O
default	O
)	O
,	O
and	O
strings	O
.	O
</s>
<s>
Typical	O
data	O
structures	O
such	O
as	O
arrays	B-Data_Structure
,	O
sets	O
,	O
lists	O
,	O
and	O
records	O
can	O
be	O
represented	O
using	O
Lua	B-Language
's	O
single	O
native	O
data	O
structure	B-Language
,	O
the	O
table	O
,	O
which	O
is	O
essentially	O
a	O
heterogeneous	O
associative	B-Application
array	I-Application
.	O
</s>
<s>
Lua	B-Language
implements	O
a	O
small	O
set	O
of	O
advanced	O
features	O
such	O
as	O
first-class	B-Application
functions	I-Application
,	O
garbage	B-General_Concept
collection	I-General_Concept
,	O
closures	B-Language
,	O
proper	O
tail	B-Language
calls	I-Language
,	O
coercion	O
(	O
automatic	O
conversion	O
between	O
string	O
and	O
number	O
values	O
at	O
run	B-Library
time	I-Library
)	O
,	O
coroutines	B-Architecture
(	O
cooperative	O
multitasking	O
)	O
and	O
dynamic	B-Operating_System
module	I-Operating_System
loading	I-Operating_System
.	O
</s>
<s>
A	O
comment	O
in	O
Lua	B-Language
starts	O
with	O
a	O
double-hyphen	O
and	O
runs	O
to	O
the	O
end	O
of	O
the	O
line	O
,	O
similar	O
to	O
Ada	B-Language
,	O
Eiffel	B-Language
,	O
Haskell	B-Language
,	O
SQL	B-Language
and	O
VHDL	B-Language
.	O
</s>
<s>
Lua	B-Language
has	O
one	O
type	O
of	O
conditional	B-Language
test	O
:	O
if	O
then	O
end	O
with	O
optional	O
else	O
and	O
elseif	O
then	O
execution	O
control	O
constructs	O
.	O
</s>
<s>
Lua	B-Language
has	O
four	O
types	O
of	O
conditional	B-Language
loops	O
:	O
the	O
while	O
loop	O
,	O
the	O
repeat	O
loop	O
(	O
similar	O
to	O
a	O
do	O
while	O
loop	O
)	O
,	O
the	O
numeric	B-Algorithm
for	B-Language
loop	I-Language
,	O
and	O
the	O
generic	O
for	B-Language
loop	I-Language
.	O
</s>
<s>
The	O
generic	O
for	B-Language
loop	I-Language
:	O
</s>
<s>
Loops	O
can	O
also	O
be	O
nested	B-General_Concept
(	O
put	O
inside	O
of	O
another	O
loop	O
)	O
.	O
</s>
<s>
Lua	B-Language
's	O
treatment	O
of	O
functions	O
as	O
first-class	B-Application
values	O
is	O
shown	O
in	O
the	O
following	O
example	O
,	O
where	O
the	O
print	O
function	O
's	O
behavior	O
is	O
modified	O
:	O
</s>
<s>
Any	O
future	O
calls	O
to	O
print	O
will	O
now	O
be	O
routed	O
through	O
the	O
new	O
function	O
,	O
and	O
because	O
of	O
Lua	B-Language
's	O
lexical	O
scoping	O
,	O
the	O
old	O
print	O
function	O
will	O
only	O
be	O
accessible	O
by	O
the	O
new	O
,	O
modified	O
print	O
.	O
</s>
<s>
Lua	B-Language
also	O
supports	O
closures	B-Language
,	O
as	O
demonstrated	O
below	O
:	O
</s>
<s>
A	O
new	O
closure	B-Language
for	O
the	O
variable	O
x	O
is	O
created	O
every	O
time	O
addto	O
is	O
called	O
,	O
so	O
that	O
each	O
new	O
anonymous	B-General_Concept
function	I-General_Concept
returned	O
will	O
always	O
access	O
its	O
own	O
x	O
parameter	O
.	O
</s>
<s>
The	O
closure	B-Language
is	O
managed	O
by	O
Lua	B-Language
's	O
garbage	B-General_Concept
collector	I-General_Concept
,	O
just	O
like	O
any	O
other	O
object	O
.	O
</s>
<s>
Tables	O
are	O
the	O
most	O
important	O
data	O
structures	O
(	O
and	O
,	O
by	O
design	O
,	O
the	O
only	O
built-in	O
composite	O
data	O
type	O
)	O
in	O
Lua	B-Language
and	O
are	O
the	O
foundation	O
of	O
all	O
user-created	O
types	O
.	O
</s>
<s>
They	O
are	O
associative	B-Application
arrays	I-Application
with	O
addition	O
of	O
automatic	O
numeric	B-Algorithm
key	O
and	O
special	O
syntax	O
.	O
</s>
<s>
A	O
table	O
is	O
a	O
collection	O
of	O
key	O
and	O
data	O
pairs	O
,	O
where	O
the	O
data	O
is	O
referenced	O
by	O
key	O
;	O
in	O
other	O
words	O
,	O
it	O
is	O
a	O
hashed	B-Algorithm
heterogeneous	O
associative	B-Application
array	I-Application
.	O
</s>
<s>
A	O
key	O
(	O
index	O
)	O
can	O
be	O
any	O
value	O
except	O
nil	O
and	O
NaN	O
,	O
including	O
functions	O
.	O
</s>
<s>
A	O
table	O
is	O
often	O
used	O
as	O
structure	B-Language
(	O
or	O
record	O
)	O
by	O
using	O
strings	O
as	O
keys	O
.	O
</s>
<s>
Because	O
such	O
use	O
is	O
very	O
common	O
,	O
Lua	B-Language
features	O
a	O
special	O
syntax	O
for	O
accessing	O
such	O
fields	O
.	O
</s>
<s>
A	O
numeric	B-Algorithm
key	O
1	O
is	O
distinct	O
from	O
a	O
string	O
key	O
"	O
1	O
"	O
.	O
</s>
<s>
Using	O
a	O
hash	B-Algorithm
map	I-Algorithm
to	O
emulate	O
an	O
array	O
is	O
normally	O
slower	O
than	O
using	O
an	O
actual	O
array	O
;	O
however	O
,	O
Lua	B-Language
tables	O
are	O
optimized	O
for	O
use	O
as	O
arrays	B-Data_Structure
to	O
help	O
avoid	O
this	O
issue	O
.	O
</s>
<s>
Extensible	O
semantics	B-Application
is	O
a	O
key	O
feature	O
of	O
Lua	B-Language
,	O
and	O
the	O
metatable	O
concept	O
allows	O
powerful	O
customization	O
of	O
tables	O
.	O
</s>
<s>
For	O
any	O
n	O
,	O
fibs[n]	O
will	O
give	O
the	O
n-th	O
Fibonacci	B-Algorithm
number	I-Algorithm
using	O
dynamic	B-Algorithm
programming	I-Algorithm
and	O
memoization	O
.	O
</s>
<s>
Although	O
Lua	B-Language
does	O
not	O
have	O
a	O
built-in	O
concept	O
of	O
classes	O
,	O
object-oriented	B-Language
programming	I-Language
can	O
be	O
emulated	O
using	O
functions	O
and	O
tables	O
.	O
</s>
<s>
Inheritance	B-Language
(	O
both	O
single	O
and	O
multiple	O
)	O
can	O
be	O
implemented	O
with	O
metatables	O
,	O
delegating	O
nonexistent	O
methods	O
and	O
fields	O
to	O
a	O
parent	O
object	O
.	O
</s>
<s>
There	O
is	O
no	O
such	O
concept	O
as	O
"	O
class	O
"	O
with	O
these	O
techniques	O
;	O
rather	O
,	O
prototypes	B-Application
are	O
used	O
,	O
similar	O
to	O
Self	B-Operating_System
or	O
JavaScript	B-Language
.	O
</s>
<s>
New	O
objects	O
are	O
created	O
either	O
with	O
a	O
factory	B-Language
method	I-Language
(	O
that	O
constructs	O
new	O
objects	O
from	O
scratch	O
)	O
or	O
by	O
cloning	O
an	O
existing	O
object	O
.	O
</s>
<s>
Here	O
,	O
tells	O
Lua	B-Language
to	O
look	O
for	O
an	O
element	O
in	O
the	O
table	O
if	O
it	O
is	O
not	O
present	O
in	O
the	O
table	O
.	O
</s>
<s>
Lua	B-Language
provides	O
some	O
syntactic	O
sugar	O
to	O
facilitate	O
object	O
orientation	O
.	O
</s>
<s>
To	O
declare	O
member	B-Language
functions	I-Language
inside	O
a	O
prototype	O
table	O
,	O
one	O
can	O
use	O
,	O
which	O
is	O
equivalent	O
to	O
.	O
</s>
<s>
Lua	B-Language
supports	O
using	O
metatables	O
to	O
give	O
Lua	B-Language
class	B-Language
inheritance	I-Language
.	O
</s>
<s>
Lua	B-Language
also	O
supports	O
multiple	B-Application
inheritance	I-Application
;	O
can	O
either	O
be	O
a	O
function	O
or	O
a	O
table	O
.	O
</s>
<s>
Operator	O
overloading	O
can	O
also	O
be	O
done	O
;	O
Lua	B-Language
metatables	O
can	O
have	O
elements	O
such	O
as	O
,	O
,	O
and	O
so	O
on	O
.	O
</s>
<s>
Lua	B-Language
programs	O
are	O
not	O
interpreted	B-Application
directly	O
from	O
the	O
textual	O
Lua	B-Language
file	O
,	O
but	O
are	O
compiled	B-Language
into	O
bytecode	O
,	O
which	O
is	O
then	O
run	O
on	O
the	O
Lua	B-Language
virtual	B-Architecture
machine	I-Architecture
.	O
</s>
<s>
The	O
compilation	B-Language
process	O
is	O
typically	O
invisible	O
to	O
the	O
user	O
and	O
is	O
performed	O
during	O
run-time	B-Library
,	O
especially	O
when	O
a	O
JIT	O
compiler	B-Language
is	O
used	O
,	O
but	O
it	O
can	O
be	O
done	O
offline	O
in	O
order	O
to	O
increase	O
loading	O
performance	O
or	O
reduce	O
the	O
memory	O
footprint	O
of	O
the	O
host	O
environment	O
by	O
leaving	O
out	O
the	O
compiler	B-Language
.	O
</s>
<s>
Lua	B-Language
bytecode	O
can	O
also	O
be	O
produced	O
and	O
executed	O
from	O
within	O
Lua	B-Language
,	O
using	O
the	O
dump	O
function	O
from	O
the	O
string	O
library	O
and	O
the	O
load/loadstring/loadfile	O
functions	O
.	O
</s>
<s>
Lua	B-Language
version	O
5.3.4	O
is	O
implemented	O
in	O
approximately	O
24,000	O
lines	O
of	O
C	B-Language
code	O
.	O
</s>
<s>
Like	O
most	O
CPUs	O
,	O
and	O
unlike	O
most	O
virtual	B-Architecture
machines	I-Architecture
(	O
which	O
are	O
stack-based	B-Application
)	O
,	O
the	O
Lua	B-Language
VM	O
is	O
register-based	B-Application
,	O
and	O
therefore	O
more	O
closely	O
resembles	O
an	O
actual	O
hardware	O
design	O
.	O
</s>
<s>
The	O
virtual	B-Architecture
machine	I-Architecture
of	O
Lua	B-Language
5	O
is	O
one	O
of	O
the	O
first	O
register-based	B-Application
pure	O
VMs	O
to	O
have	O
a	O
wide	O
use	O
.	O
</s>
<s>
Parrot	B-Language
and	O
Android	B-Application
's	O
Dalvik	B-Application
are	O
two	O
other	O
well-known	O
register-based	B-Application
VMs	O
.	O
</s>
<s>
PCScheme	O
's	O
VM	O
was	O
also	O
register-based	B-Application
.	O
</s>
<s>
This	O
example	O
is	O
the	O
bytecode	O
listing	O
of	O
the	O
factorial	O
function	O
defined	O
above	O
(	O
as	O
shown	O
by	O
the	O
luac	O
5.1	O
compiler	B-Language
)	O
:	O
</s>
<s>
Lua	B-Language
is	O
intended	O
to	O
be	O
embedded	O
into	O
other	O
applications	O
,	O
and	O
provides	O
a	O
C	B-Language
API	B-Application
for	O
this	O
purpose	O
.	O
</s>
<s>
The	O
API	B-Application
is	O
divided	O
into	O
two	O
parts	O
:	O
the	O
Lua	B-Language
core	O
and	O
the	O
Lua	B-Language
auxiliary	O
library	O
.	O
</s>
<s>
The	O
Lua	B-Language
API	B-Application
's	O
design	O
eliminates	O
the	O
need	O
for	O
manual	O
reference	B-General_Concept
management	I-General_Concept
in	O
C	B-Language
code	O
,	O
unlike	O
Python	B-Language
's	O
API	B-Application
.	O
</s>
<s>
The	O
API	B-Application
,	O
like	O
the	O
language	O
,	O
is	O
minimalistic	O
.	O
</s>
<s>
Advanced	O
functionality	O
is	O
provided	O
by	O
the	O
auxiliary	O
library	O
,	O
which	O
consists	O
largely	O
of	O
preprocessor	B-General_Concept
macros	O
which	O
assist	O
with	O
complex	O
table	O
operations	O
.	O
</s>
<s>
The	O
Lua	B-Language
C	B-Language
API	B-Application
is	O
stack	B-Application
based	O
.	O
</s>
<s>
Lua	B-Language
provides	O
functions	O
to	O
push	B-Application
and	I-Application
pop	I-Application
most	O
simple	O
C	B-Language
data	O
types	O
(	O
integers	O
,	O
floats	B-Algorithm
,	O
etc	O
.	O
)	O
</s>
<s>
to	O
and	O
from	O
the	O
stack	B-Application
,	O
as	O
well	O
as	O
functions	O
for	O
manipulating	O
tables	O
through	O
the	O
stack	B-Application
.	O
</s>
<s>
The	O
Lua	B-Language
stack	B-Application
is	O
somewhat	O
different	O
from	O
a	O
traditional	O
stack	B-Application
;	O
the	O
stack	B-Application
can	O
be	O
indexed	O
directly	O
,	O
for	O
example	O
.	O
</s>
<s>
Negative	O
indices	O
indicate	O
offsets	O
from	O
the	O
top	O
of	O
the	O
stack	B-Application
.	O
</s>
<s>
Marshalling	B-Application
data	O
between	O
C	B-Language
and	O
Lua	B-Language
functions	O
is	O
also	O
done	O
using	O
the	O
stack	B-Application
.	O
</s>
<s>
To	O
call	O
a	O
Lua	B-Language
function	O
,	O
arguments	O
are	O
pushed	O
onto	O
the	O
stack	B-Application
,	O
and	O
then	O
the	O
lua_call	O
is	O
used	O
to	O
call	O
the	O
actual	O
function	O
.	O
</s>
<s>
When	O
writing	O
a	O
C	B-Language
function	O
to	O
be	O
directly	O
called	O
from	O
Lua	B-Language
,	O
the	O
arguments	O
are	O
read	O
from	O
the	O
stack	B-Application
.	O
</s>
<s>
Here	O
is	O
an	O
example	O
of	O
calling	O
a	O
Lua	B-Language
function	O
from	O
C	B-Language
:	O
</s>
<s>
The	O
C	B-Language
API	B-Application
also	O
provides	O
some	O
special	O
tables	O
,	O
located	O
at	O
various	O
"	O
pseudo-indices	O
"	O
in	O
the	O
Lua	B-Language
stack	B-Application
.	O
</s>
<s>
At	O
LUA_GLOBALSINDEX	O
prior	O
to	O
Lua	B-Language
5.2	O
is	O
the	O
globals	O
table	O
,	O
_G	O
from	O
within	O
Lua	B-Language
,	O
which	O
is	O
the	O
main	O
namespace	O
.	O
</s>
<s>
There	O
is	O
also	O
a	O
registry	O
located	O
at	O
LUA_REGISTRYINDEX	O
where	O
C	B-Language
programs	I-Language
can	O
store	O
Lua	B-Language
values	O
for	O
later	O
retrieval	O
.	O
</s>
<s>
Besides	O
standard	O
library	O
(	O
core	O
)	O
modules	O
it	O
is	O
possible	O
to	O
write	O
extensions	O
using	O
the	O
Lua	B-Language
API	B-Application
.	O
</s>
<s>
Extension	O
modules	O
are	O
shared	O
objects	O
which	O
can	O
be	O
used	O
to	O
extend	O
the	O
functionality	O
of	O
the	O
interpreter	B-Application
by	O
providing	O
native	O
facilities	O
to	O
Lua	B-Language
scripts	I-Language
.	O
</s>
<s>
Lua	B-Language
scripts	I-Language
may	O
load	O
extension	O
modules	O
using	O
require	O
,	O
just	O
like	O
modules	O
written	O
in	O
Lua	B-Language
itself	O
,	O
or	O
with	O
package.loadlib	O
.	O
</s>
<s>
When	O
a	O
C	B-Language
library	O
is	O
loaded	O
via	O
Lua	B-Language
will	O
look	O
for	O
the	O
function	O
luaopen_foo	O
and	O
call	O
it	O
,	O
which	O
acts	O
as	O
any	O
C	B-Language
function	O
callable	O
from	O
Lua	B-Language
and	O
generally	O
returns	O
a	O
table	O
filled	O
with	O
methods	O
.	O
</s>
<s>
A	O
growing	O
collection	O
of	O
modules	O
known	O
as	O
rocks	O
are	O
available	O
through	O
a	O
package	B-Application
management	I-Application
system	I-Application
called	O
LuaRocks	B-Language
,	O
in	O
the	O
spirit	O
of	O
CPAN	B-Language
,	O
RubyGems	B-Application
and	O
Python	B-Language
eggs	O
.	O
</s>
<s>
Prewritten	O
Lua	B-Language
bindings	B-Application
exist	O
for	O
most	O
popular	O
programming	O
languages	O
,	O
including	O
other	O
scripting	B-Language
languages	I-Language
.	O
</s>
<s>
For	O
C++	B-Language
,	O
there	O
are	O
a	O
number	O
of	O
template-based	O
approaches	O
and	O
some	O
automatic	O
binding	O
generators	O
.	O
</s>
<s>
In	O
video	O
game	O
development	O
,	O
Lua	B-Language
is	O
widely	O
used	O
as	O
a	O
scripting	B-Language
language	I-Language
by	O
programmers	O
,	O
mainly	O
due	O
to	O
its	O
perceived	O
easiness	O
to	O
embed	O
,	O
fast	O
execution	O
,	O
and	O
short	O
learning	B-General_Concept
curve	I-General_Concept
.	O
</s>
<s>
Notable	O
games	O
which	O
use	O
Lua	B-Language
include	O
Roblox	B-Protocol
,	O
Garry	B-Language
's	I-Language
Mod	I-Language
,	O
World	B-Protocol
of	I-Protocol
Warcraft	I-Protocol
,	O
Payday	B-Application
2	I-Application
,	O
Phantasy	B-Protocol
Star	I-Protocol
Online	I-Protocol
2	I-Protocol
,	O
Dota	B-Application
2	I-Application
,	O
Crysis	B-Application
,	O
and	O
many	O
others	O
.	O
</s>
<s>
Some	O
games	O
that	O
do	O
not	O
natively	O
support	O
Lua	B-Language
programming	O
or	O
scripting	B-Language
,	O
have	O
this	O
functionality	O
added	O
by	O
mods	O
,	O
such	O
as	O
ComputerCraft	O
does	O
for	O
Minecraft	B-Application
.	O
</s>
<s>
In	O
addition	O
,	O
Lua	B-Language
is	O
also	O
used	O
in	O
non-video	O
game	O
software	O
,	O
such	O
as	O
Adobe	B-Operating_System
Lightroom	I-Operating_System
,	O
Moho	B-Language
,	O
iClone	B-Operating_System
,	O
Aerospike	B-Operating_System
and	O
certain	O
system	O
software	O
in	O
FreeBSD	B-Operating_System
and	O
NetBSD	B-Device
,	O
and	O
is	O
used	O
as	O
a	O
template	O
scripting	B-Language
language	I-Language
on	O
MediaWiki	B-Application
using	O
the	O
Scribunto	O
extension	O
.	O
</s>
<s>
In	O
2003	O
,	O
a	O
poll	O
conducted	O
by	O
GameDev.net	O
showed	O
Lua	B-Language
was	O
the	O
most	O
popular	O
scripting	B-Language
language	I-Language
for	O
game	O
programming	O
.	O
</s>
<s>
On	O
12	O
January	O
2012	O
,	O
Lua	B-Language
was	O
announced	O
as	O
a	O
winner	O
of	O
the	O
Front	O
Line	O
Award	O
2011	O
from	O
the	O
magazine	O
Game	O
Developer	O
in	O
the	O
category	O
Programming	O
Tools	O
.	O
</s>
<s>
A	O
large	O
number	O
of	O
non-game	O
applications	O
also	O
use	O
Lua	B-Language
for	O
extensibility	O
,	O
such	O
as	O
LuaTeX	B-Language
,	O
an	O
implementation	O
of	O
the	O
TeX	B-Application
type-setting	O
language	O
,	O
Redis	B-Operating_System
,	O
a	O
key-value	B-Data_Structure
database	I-Data_Structure
,	O
Neovim	O
,	O
a	O
text	O
editor	O
,	O
Nginx	B-Operating_System
,	O
a	O
web	B-Application
server	I-Application
,	O
and	O
Wireshark	B-Language
,	O
a	O
network	O
packet	O
analyzer	O
.	O
</s>
<s>
Through	O
the	O
Scribunto	O
extension	O
,	O
Lua	B-Language
is	O
available	O
as	O
a	O
server-side	O
scripting	B-Language
language	I-Language
in	O
the	O
MediaWiki	B-Application
software	I-Application
that	O
powers	O
Wikipedia	O
and	O
other	O
wikis	O
.	O
</s>
<s>
MoonScript	O
is	O
a	O
dynamic	B-Language
,	O
whitespace-sensitive	O
scripting	B-Language
language	I-Language
inspired	O
by	O
CoffeeScript	B-Application
,	O
which	O
is	O
compiled	B-Language
into	O
Lua	B-Language
.	O
</s>
<s>
A	O
notable	O
usage	O
of	O
MoonScript	O
is	O
the	O
video	O
game	O
distribution	O
website	O
Itch.io	O
.	O
</s>
<s>
Haxe	B-Language
supports	O
compilation	B-Language
to	O
a	O
Lua	B-Language
target	O
,	O
supporting	O
Lua	B-Language
5.1-5.3	O
as	O
well	O
as	O
LuaJIT	B-Application
2.0	O
and	O
2.1	O
.	O
</s>
<s>
Fennel	O
,	O
a	O
Lisp	B-Language
dialect	O
that	O
targets	O
Lua	B-Language
.	O
</s>
<s>
Urn	O
,	O
a	O
Lisp	B-Language
dialect	O
that	O
is	O
built	O
on	O
Lua	B-Language
.	O
</s>
<s>
Amulet	O
,	O
an	O
ML-like	O
functional	B-Language
language	I-Language
,	O
whose	O
compiler	B-Language
outputs	O
Lua	B-Language
files	O
.	O
</s>
<s>
Luau	O
from	O
Roblox	B-Protocol
,	O
Lua	B-Language
5.1	I-Language
language	O
with	O
gradual	O
typing	O
and	O
ergonomic	O
additions	O
.	O
</s>
<s>
Ravi	O
,	O
JIT-enabled	O
Lua	B-Language
5.3	O
language	O
with	O
optional	O
static	O
typing	O
.	O
</s>
<s>
Shine	O
,	O
a	O
fork	O
of	O
LuaJIT	B-Application
with	O
many	O
extensions	O
,	O
including	O
a	O
module	O
system	O
and	O
a	O
macro	O
system	O
.	O
</s>
<s>
Glua	O
,	O
a	O
modified	O
version	O
embedded	O
into	O
the	O
game	O
Garrys	B-Language
Mod	I-Language
as	O
its	O
scripting	B-Language
language	I-Language
.	O
</s>
<s>
In	O
addition	O
,	O
the	O
Lua	B-Language
users	O
community	O
provides	O
some	O
power	O
patches	O
on	O
top	O
of	O
the	O
reference	O
C	B-Language
implementation	O
.	O
</s>
