Skip to content

Online Lua Compiler

Run Lua 5.4 code online in your browser. Standard libraries, io.read input and instant output. Free, no sign-up, nothing uploaded.

Lua

main.lua
No output yet. Press Run to see results here.

Lua

Code runs locally in your browser; it is not uploaded.

How to use

  1. Write or paste Lua code in the editor.
  2. Optional: type lines for io.read in the input box.
  3. Press Run (or Ctrl/⌘ + Enter) to see the output.

Example

-- Lua 5.4 example
local function fact(n)
  if n <= 1 then return 1 end
  return n * fact(n - 1)
end

for i = 1, 5 do
  print(i, fact(i))
end

print(("Hello, %s!"):format("Lua"))

Details and limitations

Lua 5.4 runs via wasmoon (WebAssembly). Standard libraries such as string, table and math are available.

Each run starts fresh, so no variables are kept from the previous run.

FAQ

Which Lua version is used?

Lua 5.4, running via wasmoon.

How do I read input?

Type values in the input box, one per line. Each call to io.read() returns the next line.

Is my code uploaded?

No. Your code runs in your browser. Only the runtime is downloaded from jsDelivr on first use.

Format references

Tool page updated: