.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.

What opens 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.

Windows

  • VS Code
  • ZeroBrane Studio
  • any text editor

macOS

  • VS Code
  • ZeroBrane Studio
  • any text editor

Linux

  • VS Code
  • vim
  • lua interpreter

Open a .lua file step by step

  1. Confirm the file really is a .lua. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with VS Code or ZeroBrane Studio.
  3. On Mac, use VS Code or ZeroBrane Studio.
  4. On Linux, try VS Code or vim.
  5. Still stuck? Search for a dedicated Lua viewer rather than a generic one.

Why can't I open my .lua file?

Almost always because no installed app understands Lua. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .lua at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

Lua has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.

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. How sources are ranked and what is deliberately left out is set out in the methodology.