What is Lua
Lua is a small, fast scripting language that is easy to embed inside other programs such as games.
In this page:
What is Lua
Lua is a lightweight, dynamically typed scripting language created in 1993 at PUC-Rio in Brazil. It is designed to be embedded in host applications written in C, and is widely used in game engines, tools and configuration. The interpreter is tiny and a Lua program is compiled to bytecode and run by a virtual machine.
Note:
Lua has only a few core ideas, tables, functions and metatables, and everything else is built from them.
Example: What is Lua
print("Hello from " .. _VERSION)
print("Lua is dynamically typed:", type(10), type("ten"), type(true))
-- Output:
-- Hello from Lua 5.3
-- Lua is dynamically typed: number string boolean
Login to try C/C++/Java/PHP code in the editor
Common Mistakes
- Thinking Lua stands for an acronym
- Expecting a huge standard library like Python has
- Assuming Lua only works inside games
Chapter Summary
- Lua is a lightweight scripting language
- It is designed to be embedded
- Programs run on a bytecode virtual machine
- Tables are its main data structure
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: