SplitScript reference / Language / retry
retry
keyword
let value = retry fallibleExpression | let value = retry { ... }
Retries synchronous fallible work until it succeeds.
retry creates a local error boundary around any ordinary expression. The complete operand is evaluated again once per attached update. A T! error, postfix ?, or throw ends only the current attempt; a successful final value yields T. A value block is not a special retry form: braces are ordinary expressions, so retry { ... } naturally retries every statement and its final expression. return, break, and continue keep their normal lexical targets. Like await, retry binds more tightly than fallback else. Adjacent unparenthesized forms warn because (retry value) else fallback and retry (value else fallback) establish different boundaries. The attempt itself must remain synchronous and bounded: evaluating await or another retry inside it is rejected, while merely calling an async function to construct a future is allowed. A containing function infers an async result unless its result type is explicit, in which case write -> async T. Process closure cancels the retry boundary.
Examples
Retry one fallible expression
let marker = retry readMarker()
Retry a complete fallible block
let health = retry {
let player = process.follow(module.address, offsets)?
process.read<i32>(player)?
}