Skip to content
BENIBIX Learn

Lua

Development🔤 LanguagesPopular Languages

Also known as Lua Language, Lua Script

A small, fast script language made to live inside games and apps.

Think of it like

It is like a tiny brain you put in a toy. It teaches the toy new tricks.

Example

A game lets players write Lua scripts for their own levels. The game engine itself stays in C++.

Why it matters

It lets people change a program without rebuilding it. Many games and tools use it for mods and settings.

Definition

Lua is a small, fast scripting language made to be put inside other programs. A game or app is written in a big language like C. It then lets Lua scripts control parts of it, like how a level plays. Lua was made at a university in Brazil, called PUC-Rio. It is a leading scripting language in games.

Example code

lua
for i = 1, 3 do
  print("Hello " .. i)
end
Print a hello three times. The two dots join text together.
Lua sits on the shell and scripting shelf, made to live inside apps.

Common mistake

Counting from 0. Lua lists start at 1, so code ported from other languages is often off by one.

Key takeaways

  1. 1
    Small. Fits inside other programs.
  2. 2
    Embeddable. The host app runs it.
  3. 3
    Starts at 1. Lists count from one.

Compare

Learn it properly