Menu

Online Lua Compiler

Write, run, and share code snippets — no setup required.

main.lua
Output
Click Run to see the output here.

Run Lua online in your browser

A free online Lua playground and code runner. Write Lua scripts in your browser, hit Run, and the standard Lua interpreter executes them in seconds. No luarocks, no build, no local install to configure first.

The editor is built on the same engine as VS Code, so Lua syntax highlighting, autocompletion, and error squiggles all work. Code runs against the Lua interpreter on Alpine Linux, with the standard libraries available — string, table, math, io, os, and coroutine. Good for learning Lua for game scripting, embedded config, or Redis scripting.

What makes this Lua playground useful

  • Instant Lua execution — write code, press Run, and see output from the Lua interpreter in seconds, no luarocks or build step needed.
  • Full Lua syntax highlighting, autocompletion, and clear error messages with line numbers, powered by the same editor engine as VS Code.
  • Stdin input is supported. io.read(), io.read('*l'), and io.lines() all read from the playground's input box, so interactive Lua scripts behave the same as running them at the terminal. No Lua interpreter, luarocks, or build tools on your end.
  • Lua interpreter with tables, metatables, coroutines, and the standard string/math/io libraries — everything you need for scripting practice.

What you can build in the Lua playground

  • Tables as arrays, records, and hash maps: the one composite type that makes Lua elegant, testable one assignment at a time.
  • Metatables and metamethods (__index, __newindex, __add, __call): the object-system building blocks you use in game scripting and embedded configs.
  • Quick Lua experiments: test a pattern-matching call with string.match, verify a coroutine's yield/resume flow, or try a closure over an upvalue.

Online Lua compiler FAQ

Is the online Lua compiler free?
Yes, the Lua playground is free to use. No sign-up, no Lua interpreter to install, and no luarocks setup — open the page and run code.
Do I need Lua or luarocks installed?
No install needed. You don't need Lua, luarocks, or any build tools on your machine. The online Lua runner executes your scripts with the Lua interpreter and returns the output in seconds.
Does the Lua playground work on mobile and Chromebooks?
Yes. The Lua playground runs in any modern browser, on desktop, tablet or mobile. Good for testing Lua scripts from a Chromebook, iPad, or school computer.
Does the Lua playground support io.read() and stdin?
Yes. io.read(), io.read('*l') for a single line, and io.lines() for iterating all read your typed lines the same way they would when you run lua script.lua at the terminal.
How do I learn Lua after trying the playground?
Edit the sample Lua code, press Run, and iterate. When you want something more structured, Coddy's interactive Lua course covers tables, metatables, coroutines, and the standard library with hands-on exercises — a solid base whether you're headed for game scripting or embedded use.