Chapter V ·
Under the hood
/
Lesson 26 of 27
The bytecode model
You'll learn: Read a disassembled prototype: instructions, registers, upvalues, and nested protos.
The compiler lowers Lua to a stream of *register-based*
opcodes — no labels, no PC-relative jumps. Each function
becomes a %Lua.Compiler.Prototype{} with its own register
window and upvalue descriptors. Toggle Bytecode to see the
layout. Full reference at /reference/opcodes.
Output
idle
Hit Run to execute.
Try it:
Toggle Bytecode. Count the prototypes (
function #N headers). Find the closure op that builds the inner function and the get_upvalue op that reads seed.