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

This is a free online Lua playground and code runner. Write Lua scripts directly in your browser, hit Run, and execute with the standard Lua interpreter in seconds — no luarocks, no build, no local install required. It's the fastest way to try a table trick, test a metatable, or work through a Lua scripting exercise.

Under the hood, the editor uses the same engine as VS Code (Lua syntax highlighting, autocompletion, error squiggles), and your code runs against the Lua interpreter on Alpine Linux with the standard libraries available — string, table, math, io, os, and coroutine. Whether you're learning Lua for game scripting, embedded config, or Redis scripting, this online Lua compiler goes from idea to output in seconds.

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 — the same editor engine that powers VS Code.
  • Stdin input supported — io.read(), io.read('*l'), and io.lines() all read from the playground's input box, so interactive Lua scripts work exactly like running them at the terminal. No install — no Lua interpreter, luarocks, or build tools.
  • 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 completely free — no sign-up, no Lua interpreter to install, 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 on any modern browser — desktop, tablet, or mobile. Great for testing Lua scripts from a Chromebook, iPad, or school computer.
Does the Lua playground support io.read() and stdin?
Yes. The playground has a stdin input box — 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 structured practice, 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.