pub struct LuaProto {Show 15 fields
pub numparams: u8,
pub is_vararg: bool,
pub maxstacksize: u8,
pub upvalues: Vec<UpvalDesc>,
pub k: Vec<LuaValue>,
pub code: Vec<Instruction>,
pub p: Vec<GcRef<LuaProto>>,
pub lineinfo: Vec<i8>,
pub abslineinfo: Vec<AbsLineInfo>,
pub locvars: Vec<LocalVar>,
pub linedefined: i32,
pub lastlinedefined: i32,
pub source: Option<GcRef<LuaString>>,
pub cache: RefCell<Option<GcRef<LuaLClosure>>>,
pub vararg_table_reg: Option<u8>,
}Fields§
§numparams: u8§is_vararg: bool§maxstacksize: u8§upvalues: Vec<UpvalDesc>§k: Vec<LuaValue>§code: Vec<Instruction>§p: Vec<GcRef<LuaProto>>§lineinfo: Vec<i8>§abslineinfo: Vec<AbsLineInfo>§locvars: Vec<LocalVar>§linedefined: i32§lastlinedefined: i32§source: Option<GcRef<LuaString>>§cache: RefCell<Option<GcRef<LuaLClosure>>>Last closure instantiated from this proto, reused by OP_CLOSURE when a
new instantiation would capture the identical upvalues. Mirrors C-Lua’s
Proto.cache (5.2/5.3 only — added in 5.2, removed in 5.4), which is why
loop-built closures with shared upvalues compare == on those versions.
Populated only under 5.2/5.3 in push_closure; None otherwise. Traced
(so it cannot dangle); unlike C’s GC-cleared weak cache this pins the one
cached closure to the proto’s lifetime, which is bounded and safe.
vararg_table_reg: Option<u8>Lua 5.5 named varargs (function f(...t)): the register holding the
packed vararg table t. When set, ... unpacks live from that table
(count = its n field) rather than the frame’s extra-arg slots, so
mutating t is observable through a later ... (shared storage). None
for ordinary ... and all pre-5.5 functions. Mirrors upstream’s
needvatab proto flag + the vararg-table register.