.lua

What is a .lua file?

Lua Source File · Code and data · PUC-Rio (Roberto Ierusalimschy et al.) · 1993

A .lua file is Lua source code, a small, fast scripting language designed to be embedded inside other programs. It is widely used for game scripting, plugins and configuration.

Category
Code and data
Type
Plain text
Is a .lua file safe to open? Caution. A .lua file is a script that executes when run. Review unfamiliar scripts, especially game mods, before running them.

What is a .lua file used for?

Lua is prized for being tiny and easy to embed, so it turns up inside games (Roblox, World of Warcraft), the Redis database, and countless applications that let users script behaviour. It is interpreted, run with the lua command or the host program.

The files are plain text and open in any editor. A related .luac file is precompiled Lua bytecode.

How to open a .lua file

The .lua format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .lua file.

Windows

  • VS Code
  • ZeroBrane Studio
  • any text editor

macOS

  • VS Code
  • ZeroBrane Studio
  • any text editor

Linux

  • VS Code
  • vim
  • lua interpreter

.lua file signature (magic bytes)

Programs recognise a .lua file by the bytes at the start of the file, not by its name. These are the signatures for Lua.

Hex signatureOffsetNote
(no fixed signature)0plain text; no fixed magic bytes

See the full magic-numbers reference for every format.

Frequently asked questions

What is a .lua file?

A .lua file is Lua source code, a small, fast scripting language designed to be embedded inside other programs. It is widely used for game scripting, plugins and configuration.

How do I run a .lua file?

Install Lua and run lua file.lua, or run it inside the program that embeds Lua, such as a game or Redis.

Why is Lua used in games?

It is small, fast and easy to embed, so game engines expose Lua to let designers and players script behaviour without touching the engine's core.

How do I open a .lua file?

Any text editor shows the source. VS Code and ZeroBrane Studio add Lua highlighting and debugging.

Related formats

Sources

Details on this page were checked against authoritative references: