Lua Playground

Write Lua, run it on the BEAM, and watch the register-based bytecode this VM actually executes. No JavaScript Lua — every byte is Elixir.

Classic recursion. Watch the closure prototype and tail-calls in the bytecode.
main.lua
Output
idle
Hit Run or press to execute.
Bytecode · Lua.Compiler.Prototype
2 protos
params
0
vararg
yes
registers
15
upvalues
0
000 load_env r0
001 L1 source_line line 1
002 L1 closure r5, proto[0]
003 L1 move r1, r5
004 L1 set_open_upvalue r1, r5
005 L6 source_line line 6
006 L6 load_constant r8, 0
007 L6 load_constant r9, 10
008 L6 load_constant r10, 1
009 L6 move r5, r8
010 L6 move r6, r9
011 L6 move r7, r10
012 L6 numeric_for r5
013 L10 source_line line 10
014 L10 get_open_upvalue r5, r1
015 L10 load_constant r7, 15
016 L10 move r6, r7
017 L10 call r5, args=1, results=-1
Run +
Indent Tab / Shift + Tab
Heads-up Snippets run in a sandboxed VM with a 1.5s timeout.