MMTMMT Docs
Diagnostics

S008

user function called in a setup expression

S008

Functions you define run while the script runs, so setup cannot call them. Write the expression directly in the setup binding (built-ins that work in setup and ? : are fine), or compute the value in a handler (on <sub>.update) and store it in state.

Failing example

script "example"
fn one() -> int { return 1 }
setup value = one()

Corrected example

script "fixed"
fn one() -> int { return 1 }
data chart = subscribe(data.ohlcv)
on chart.update { let value = one() }

On this page