method
Math.wrap
Math.wrap(v, lo, hi) -> int
Wraps v into the half-open range lo..hi, so values that run off one end reappear at the other — the toroidal counterpart to Math.clamp. Use it for wrap-around movement, cycling through a menu, or keeping a scrolling offset in bounds.
Example
program Demo {
handler Step phase Update {
let x = Math.wrap(player_x, 0, world_width)
}
}