Setting Up Your Environment
Prerequisites: Installing Lua
Editor
Visual Studio Code with the Lua extension (by sumneko, powered by lua-language-server) gives autocompletion, error checking, hover documentation, and type hints from annotations. Neovim uses the same language server.
ZeroBrane Studio is a lightweight Lua IDE with a built-in debugger, popular for teaching and for LÖVE.
The interactive prompt
Run lua with no arguments to get an interactive prompt (a REPL):
$ lua
Lua 5.4.8 Copyright (C) 1994-2025 Lua.org, PUC-Rio
> 1 + 2
3
> "Lua" .. " rocks"
Lua rocks
> os.exit()
Type an expression to see its value. Press Ctrl + D (Linux/macOS) or
Ctrl + Z then Enter (Windows) to quit, or call os.exit().
Running files
lua hello.lua
lua -i hello.lua # run the file, then stay in the REPL
Formatting and linting
- StyLua formats Lua code consistently.
- luacheck finds unused variables, accidental globals, and typos.