Consider a switch statement (if-elseif chain) versus a binary search tree of if s. The bytecode looks identical. The decompiler must guess.
Lua’s VM uses (fast, fixed slots), but source code uses local variables (named, scoped). The compiler maps variables to registers. A decompiler must reconstruct which registers hold which variables at which lines—and assign them unique names ( local a , local temp_1 ). This is a form of live variable analysis . lua decompiler
When you run luac -o script.luac script.lua , the compiler produces a binary file containing: Consider a switch statement (if-elseif chain) versus a