Guarded calls and loop helpers
On this page
Breakpoint()#
Breakpoint() -> voidReach a native GDScript breakpoint statement.
Returns: Void.
Breakpoint()Use in an actual Godot debugging session. It is not PCA Script VM stepping.
TryCall()#
TryCall(callable: Callable, arguments: Array = [], fallback: Variant = null) -> DictionaryCheck whether a Callable is valid, then invoke it with an argument array.
Returns: Dictionary with ok, value and error.
TryCall(func(value): return value + 1, [4], 0)An invalid Callable returns ok=false and fallback. A runtime error inside a valid Callable is not caught as an exception. The helper does not await a coroutine body.
DoWhile()#
DoWhile(body: Callable, condition: Callable, safety_limit: int = 100000) -> intRun a Callable body at least once, then check a Callable condition after each pass.
Returns: Number of iterations.
DoWhile(func(i): print(i), func(i): return i < 3)Body receives the zero-based index. Condition receives the incremented count. Safety limit defaults to 100000 and is clamped to at least 1. Calls are synchronous.
