The real Lua interpreter, in a web page
Lua is a small, fast scripting language used inside games and apps (Roblox's Luau, World of Warcraft add-ons, LÖVE, Neovim, Redis scripts and many embedded devices). This page runs the reference Lua 5.4 interpreter from PUC-Rio, compiled to WebAssembly through the wasmoon project and hosted on this site. Your script executes on your own device in a background worker, and print() and io.write() output appears in the panel below.
Language features
Everything in standard Lua 5.4 is available: tables as arrays and dictionaries, metatables and metamethods, closures, varargs, coroutines, integer and float subtypes, integer division with //, bitwise operators, the goto statement, and the string, table, math and utf8 libraries, including Lua patterns with string.find, gsub and gmatch. Errors include the line number, for example [string "..."]:3: attempt to index a nil value, so you can find mistakes quickly.
Input
Put input lines in the Input box. Each io.read() returns the next line, io.read("n") converts it to a number, and it returns nil when there is nothing left, which lets you write loops that read until the end of input.
Lua vs Luau (Roblox)
Roblox uses Luau, a dialect derived from Lua 5.1 with type annotations, compound assignment such as +=, and the Roblox API objects like game and workspace. Plain Lua logic, loops, tables and functions behave the same, so this is a good place to practise the language itself, but Roblox-specific objects and Luau-only syntax will produce errors here.
Limits and privacy
There is no file system or operating-system access, so io.open and os.execute do not work. Infinite loops are ended with Stop or by the time limit. Code is never uploaded; share links store it inside the address after the # sign.