Skip to main content

gmatch_aux

Function gmatch_aux 

Source
pub fn gmatch_aux(state: &mut LuaState) -> Result<usize, LuaError>
Expand description

Continuation function for string.gmatch iterator closure.

The 5.3+ gmatch iterator step (the default registered by gmatch).

Reads the iterator’s three closure upvalues: 1 and 2 are the traced source and pattern strings; 3 is a userdata whose host payload ([GMatchIterState]) holds the mutable byte positions advanced across calls.

DEDUP is monomorphized — true for this 5.3+ entry, false for gmatch_aux_legacy (5.1/5.2). Specializing on it (rather than reading a runtime flag in this per-match-hot function) keeps the 5.3+ path’s codegen byte-identical to the pre-P2c single-version matcher; the empty-match seam costs nothing on the common path.