Yarnspinnex.HostFunctions behaviour (yarnspinnex v0.3.0)

Copy Markdown View Source

Behaviour for the game-specific functions a script may call, beyond Yarnspinnex.Functions.

declared/0 is read at compile time: it validates every call in the script and doubles as the manifest an editor can list. call/3 receives the context passed to Yarnspinnex.step/3 exactly as the host gave it.

Summary

Callbacks

Evaluates a declared function against the caller's context.

Every callable function as {name, arity}; the compiler rejects any call not listed here.

Callbacks

call(name, args, context)

@callback call(name :: String.t(), args :: [term()], context :: term()) :: term()

Evaluates a declared function against the caller's context.

declared()

@callback declared() :: [{String.t(), non_neg_integer()}]

Every callable function as {name, arity}; the compiler rejects any call not listed here.