Online Lua Compiler
Run Lua scripts online with Lua 5.4. Write a script, press Run, and see what it prints beside your code, with errors shown with their line numbers. Scripts can read input with io.read as they run, and the standard string, table and math libraries are ready to use.
How to run Lua code online
- This page opens with Lua selected, so you can start typing straight away.
- Write your code in the editor, or open files from your computer: single files, or a whole project as a .zip.
- Press Run, or Ctrl+Enter. The output appears in the panel beside the editor, and when the program asks for input you type it there and press Enter.
- Share a copy with a link, or save your files to your computer.
Lua 5.4 on Online IDE
- Scripts run with the lua5.4 interpreter, from top to bottom.
- io.write prints without a new line and shows straight away, so a prompt appears before io.read("l") waits for a line.
- tonumber turns text into a number, and returns nil when the text is not a number.
- The standard libraries are available, such as string, table, math, io and os, but LuaRocks modules are not.
Example: a Lua program that reads input
io.write("How many rows? ")
local rows = math.tointeger(tonumber(io.read("l") or ""))
if not rows or rows < 1 then
print("Please enter a whole number above zero.")
else
for i = 1, rows do
print(string.rep(" ", rows - i) .. string.rep("*", 2 * i - 1))
end
end
Features of this tool
- Simple and fastA clean, lightweight editor that opens instantly.
- Powered by AceThe Ace code editor, with syntax highlighting, autocompletion and bracket matching.
- Interactive programsType input into the terminal while your program runs.
- Several filesWork in tabs, open files or a .zip from your computer, and save the project back to disk.
- Made for learningHelpful for beginners to learn and practice programs.
- Light and dark themesPlus 39 editor themes, a choice of coding fonts, and Vim, Emacs or VS Code keys.
- Keep your outputCopy or download the program output in one click.
- Share by linkSave your code in the cloud and open it anywhere.
Frequently asked questions
Which Lua version does Online IDE use?
Lua 5.4, run with the lua5.4 interpreter on Linux.
How does a Lua script read input?
Call io.read("l") to read a line you type in the output panel, or io.read("n") to read a number. Show a prompt first with io.write.
Can I use LuaRocks modules?
No. The standard libraries that come with Lua work, but LuaRocks modules are not installed and scripts cannot download them.
Can I run Roblox or LÖVE code?
Only the plain Lua parts. Roblox uses Luau, a dialect of Lua with additions such as type annotations, and LÖVE games need a window, so code that calls their functions does not run here.
Contact us
For any feedback, queries or issues, please feel free to contact us or write to . We value your input and are committed to providing the best possible experience for our users.