Lua онлайн - IDE, редактор, компилятор, интерпретатор

Мгновенно запускайте скрипты на Lua 5.4 в WebAssembly-сборке эталонного интерпретатора. Идеально для изучения Lua и проверки игровых и конфигурационных скриптов.

Lua 5.4 (wasmoon) · Работает в браузере, поэтому ваш код никогда не попадает на наши серверы.
main.luaLua
Результат

            
        
Ctrl/⌘ + Enter для запуска

Возможности онлайн-компилятора Lua (IDE, редактор и интерпретатор)

Пишите, запускайте и тестируйте код на Lua онлайн бесплатно. Эта страница — онлайн-IDE, редактор кода, компилятор и интерпретатор Lua в одном: введите код, нажмите «Запустить» и сразу увидите результат. Все работает в браузере — ничего не нужно устанавливать и не нужно создавать аккаунт.

  • Мгновенный запуск кода: Lua 5.4 (wasmoon), вывод менее чем за секунду после первой загрузки.
  • Редактор кода: подсветка синтаксиса, номера строк, подсветка парных скобок и автозакрытие скобок.
  • Понятные ошибки: сообщения об ошибках и предупреждения появляются в панели вывода так же, как на вашем компьютере.
  • Полноэкранный режим: Ctrl/⌘ + Shift + F, настраиваемый размер шрифта, расположение рядом или друг под другом и изменяемые размеры панелей.
  • Автосохранение: ваш код хранится в браузере; скачайте его как main.lua или скопируйте одним щелчком.
  • Безопасные эксперименты: ограничение времени и кнопка «Остановить» прерывают бесконечные циклы.
  • Конфиденциальность: среда выполнения Lua работает на вашем устройстве, поэтому код никогда не загружается на сервер.
  • Темная тема и сочетания клавиш: Ctrl/⌘ + Enter запускает код.
  • Бесплатно: без регистрации и ограничений использования.

Изучайте другие языки программирования

How to use the online Lua compiler

  1. Write or paste a Lua script into the editor. Reset example restores the starter code.
  2. Press Run or use Ctrl + Enter (⌘ + Enter on a Mac).
  3. Everything you pass to print() appears in the Output panel. Like the standard interpreter, multiple arguments are separated by tabs, and nil is printed as nil. Runtime and syntax errors are highlighted along with the line number.
  4. Choose a time limit of 5, 15 or 60 seconds. A script that runs too long is stopped automatically, and Stop ends it immediately.

The Lua runtime is small, well under 1 MB, so the page is ready to run almost instantly. Use Copy or main.lua to save your script.

Your script runs in a Web Worker inside your browser. It is never uploaded and is not stored on our servers. The editor remembers your last code in your browser's local storage, and in no other place.

What's supported

The compiler runs Lua 5.4 through wasmoon, a WebAssembly build of the reference Lua interpreter written in C. Your code is executed by real Lua, not by a translation into JavaScript.

  • The Lua 5.4 language: integer and float subtypes, integer division (//), bitwise operators, goto, and the <const> and <close> local attributes.
  • Standard libraries: string (including Lua patterns and string.format), table, math, utf8 and coroutine.
  • Closures, metatables and coroutines, so you can practise object-oriented and generator-style Lua.

Limitations:

  • Use print() for output. Output is captured from print, so use it rather than io.write.
  • No standard input, network access or real files. Put your test data directly in the script.
  • No C modules or LuaRocks. Only pure Lua code in the editor can run.
  • Each run gets a fresh Lua state, so globals from the previous run are cleared.

Lua quick reference

local Account = {}
Account.__index = Account

function Account.new(owner, balance)
  return setmetatable({ owner = owner, balance = balance or 0 }, Account)
end

function Account:deposit(v)
  self.balance = self.balance + v
end

local acc = Account.new("Ada")
acc:deposit(50)
print(acc.owner, acc.balance)          --> Ada  50

for word in ("one two three"):gmatch("%a+") do
  print(#word, word:upper())
end
print(7 // 2, 7 / 2)                   --> 3  3.5
TaskSyntax
Local variablelocal x = 10
Concatenate strings"a" .. "b"
Length of a string or list#t
Not equala ~= b
Numeric loopfor i = 1, 10, 2 do ... end
Iterate a list / a tablefor i, v in ipairs(t) / for k, v in pairs(t)
Format a numberstring.format("%.2f", n)

Tips

  • Lua arrays start at index 1, not 0, and # is only reliable for sequences without nil holes.
  • Declare variables with local. Without it, a variable is global, which is slower and a common source of bugs.
  • Only nil and false are falsy. 0 and the empty string are true in Lua.
  • Lua patterns look like regular expressions but are simpler, and use % instead of a backslash, as in %d+. For full regular expressions in other languages, try the regex tester.
Tip: To print a table's contents, loop over it with pairs, or use table.concat(list, ", ") for a list of strings and numbers. Passing the table itself to print(t) does not list its contents.

Frequently asked questions

Which Lua version does this use?

Lua 5.4. Run print(_VERSION) to confirm. Code written for Lua 5.3 almost always works unchanged, while Lua 5.1 or LuaJIT code may need small changes, for example replacing unpack with table.unpack.

Can I test Roblox or LÖVE scripts here?

You can test plain Lua logic, such as functions, tables, string handling and maths. Engine APIs like Roblox services (Roblox uses its own Luau dialect) or LÖVE's love.* functions do not exist here.

Why doesn't io.read work?

The compiler has no interactive standard input. Define your test values as variables at the top of the script.

What other languages can I run online?

The online Python compiler and the online Ruby compiler also run entirely in your browser.

Обновлено

Скопировано в буфер обмена