Run Lua: Try Lua 5.3 Scripts in Your Browser

What is it?

Run Lua lets you try Lua, the small scripting language used in Roblox, game mods, Neovim and many apps, right in your browser. Code runs on Fengari, a complete Lua 5.3 virtual machine, with print, io.write and io.read for input, and the string, table, math, utf8, os and coroutine libraries. A 10-second limit stops endless loops from freezing the page.

Who is it for?

Young game makers learning scripting, modders testing a function, Neovim users, and students comparing programming languages.

How to use it

  1. Type your program in Lua code (Ctrl + Enter runs it), or tap Try a sample.
  2. For io.read(), put one answer per line in Input (for io.read()). io.read("n") reads a number, io.read() a whole line.
  3. Press ▶ Run. The first time it loads Lua (about 220 KB).
  4. Read the Output; use Copy output, Download .lua or Clear output.

Worked example

local n = io.read("n")
for i = 1, n do io.write(i * i, " ") end
print()

Type 5 in the Input box and press Run: the output is “1 4 9 16 25”. Use local for variables inside functions: it is faster and avoids surprises. Your code runs in your browser and is not uploaded.

Errors and how to fix them

  • “The program ended with an error (see the output)”: the error message from the language is in the Output box. Read its last line first: it names the problem and the line number.
  • stopped after 10 seconds: is there an endless loop?: a while or repeat loop never ends. Check that its condition changes inside the loop.
  • attempt to call a nil value (global '…'): the function does not exist here. Roblox functions such as game:GetService are not available; plain Lua works.
  • attempt to perform arithmetic on a nil value: a variable was never set, often because the Input box had too few lines.

Open the tool: Run Lua

Still stuck?

Contact support. Tell us which tool or page you were using, what you tapped, what you saw, and your phone or computer and browser (for example: Android phone, Chrome). We reply by email.

Questions, or an error not listed here?

Tell us in the comments: what you were doing, the exact message you saw, and your device and browser. We read every comment and add new fixes to this article.