b2KIT

Lua Playground (WASM)

Execute Lua scripts in the browser using Fengari WebAssembly with an interactive REPL console.

Tested tool guide Tested browser tools Checked August 16, 2026

What Lua Playground (WASM) does, with a checked example

Paste a Lua chunk into the editor to execute it with the page's browser-resident Fengari environment, then inspect printed text and errors in the interactive console. It is suited to quick checks of Lua expressions, loops, tables, functions, and supported standard-library behavior without installing a desktop interpreter. The usual surprise is the host boundary: valid Lua can still fail when it expects arbitrary filesystem access, native C modules, or globals supplied by a game engine. Assignments do not print themselves in a normal script, so call print when output matters.

Worked example

A concrete input and expected output from the current implementation.

Input

print(1 + 2 + 3 + 4)
print(string.reverse("Lua"))

Expected output

10
auL

The first expression adds four integers and equals 10. Lua's string.reverse reverses the three ASCII characters in "Lua", producing "auL".

How the result is produced

1

Lua chunk execution

Running the editor sends its contents for evaluation as one Lua chunk. Statements execute in program order, and print writes its arguments to the console. A syntax error prevents the chunk from starting. An unhandled runtime error stops execution at the failing operation, so later statements in that chunk are not reached. The reported diagnostic is distinct from text deliberately printed by the script.

2

Browser runtime boundary

The Lua evaluator runs inside the browser rather than inside a desktop interpreter or game engine. Source and console activity remain on the device instead of being uploaded for execution. Pure Lua calculations can be tested directly, but files, native extensions, engine globals, and other host services exist only when the playground explicitly provides equivalents. Treat refreshing or closing the page as ending the current working session.

Good uses

  • Verify the exact output of a small Lua loop, table operation, function, or string transformation before placing it in a larger program.
  • Practice Lua syntax and supported standard-library functions on a machine where installing a standalone Lua interpreter is inconvenient.
  • Extract a pure Lua calculation from game scripting code to distinguish a language-logic problem from missing engine objects or callbacks.

Limits and checks

  • Successful execution under Fengari does not establish compatibility with every native Lua interpreter, Lua version, or engine-specific dialect.
  • An empty console can mean the Lua chunk only assigned variables or defined functions; add print calls before interpreting silence as failure.
  • Long or non-terminating Lua loops can consume substantial browser time or memory, and timings here are not performance measurements for the eventual host.

Common questions

Does a successful run prove that my script will work in standalone Lua?

No. It shows that the tested chunk and execution path work in this playground's Fengari environment. A standalone interpreter may provide different libraries, while an embedded runtime may add or remove modules, globals, and host services. Test again in the real target when the script depends on files, networking, native extensions, version-specific behavior, or application callbacks.

Can I use require or paste code written for a game engine?

Only when every referenced module and global is available in the playground. require cannot make an arbitrary local package, native module, or engine API appear in a browser runtime. Code that depends on objects supplied by a game engine is not self-contained Lua. Extract its pure calculation or data transformation, provide small test values, and run that isolated portion here.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools