About this Lua playground
This is a Lua compiler you can use straight away. Write Lua in the editor, press Run, and the output appears next to it: everything your program prints, any error with its line number and stack traceback, and how long it took.
Your code runs on Lua 5.4, the standard interpreter from lua.org, in an isolated sandbox on our servers, so it behaves as it would with lua main.lua on your own machine. It is free, with nothing to install and no account needed.
What you can run
- Lua 5.4, running one file per run, saved as
main.lua. - Standard library only. Lua's standard libraries are all loaded: string (with its patterns), table, math, utf8, os, io and coroutine. There are no LuaRocks modules. There is no package installer, and programs have no network access.
- Limits: 10 seconds and 256 MB of memory per run. Output past 64 KB is cut off, code can be up to 64 KB and input up to 16 KB.
- Fair use: 5 runs a minute and 50 a day without an account, 10 a minute when you are signed in.
Reading input
Open the Input box under the editor and type what your program should read. io.read("l") reads the next line and io.read("n") the next number. With the box empty, or once everything is read, they return nil.
local name = io.read("l")Frequently asked questions
Is this online Lua compiler free?
Yes. There is no sign-up and no limit on how much you can write. Signed-out visitors get a quick, usually invisible bot check when they press Run, and a fair-use cap of 5 runs a minute and 50 a day. Signing in raises it to 10 runs a minute.
Which version of Lua does it run?
Lua 5.4, the reference interpreter from lua.org. Integers and floats are separate subtypes, and integer division (//), bitwise operators, goto, <const> and <close> variables all work.
Is this Roblox Luau or LuaJIT?
Neither. It is standard Lua 5.4. Roblox's Luau adds type annotations, compound operators such as += and its own game APIs, none of which standard Lua has, and LuaJIT follows the older Lua 5.1. Plain Lua code that uses neither runs the same everywhere.
Can I use LuaRocks modules?
No. The playground runs one file with Lua's standard libraries only: there is no LuaRocks and no network, so require can only load what ships with Lua.
Why did my program stop with a time-out?
Each run gets 10 seconds and 256 MB of memory. A program that goes past either is stopped. The usual cause is a while true do loop with no break, or a loop whose condition never changes.
Is my code saved or shared?
Your code is kept in your own browser so it is still there next time, and nowhere else. When you press Run it is sent to our code runner, run once in a sandbox, and thrown away. We do not store it or show it to anyone.