API reference / @jsprismarine/prismarine / command/function/runtime
command/function/runtime
Classes
Interfaces
FunctionRunOutcome
Defined in: packages/prismarine/src/command/function/runtime.ts:49
What one call did, which is what /function and execute if function read, plus the line count a tick reports.
Extends
Properties
commands
readonlycommands:number
Defined in: packages/prismarine/src/command/function/runtime.ts:55
How many command lines reached the dispatcher. The same as result for a function that never reached a /return, and the honest number for one that did.
matched
readonlymatched:boolean
Defined in: packages/commands/src/host.ts:576
Whether any function the call ran returned a non-zero value through /return. A tag matches when any of its members did, which is why this is not result !== 0: members returning 1 and -1 sum to 0 and still match.
Inherited from
result
readonlyresult:number
Defined in: packages/commands/src/host.ts:569
What /function reports and execute store result captures: the sum of the values /return produced, or the number of command lines that ran when nothing the call reached returned a value.
Inherited from
FunctionRuntimeOptions
Defined in: packages/prismarine/src/command/function/runtime.ts:59
How to build a FunctionRuntime.
Properties
dispatch
readonlydispatch: (commandLine,source) =>CommandOutcome
Defined in: packages/prismarine/src/command/function/runtime.ts:68
Runs one command line against a source, which is the server's vanilla dispatcher. Injected rather than imported so the runtime is testable without a dispatcher, and so nothing here depends on how a dispatch reports its results.
Parameters
commandLine
string
source
Returns
limits?
readonlyoptionallimits?:Partial<ExecutionLimits>
Defined in: packages/prismarine/src/command/function/runtime.ts:72
Overrides the two gamerule limits; see DEFAULT_EXECUTION_LIMITS.
loaded
readonlyloaded:ServerFunctions
Defined in: packages/prismarine/src/command/function/runtime.ts:61
The functions and tags the pack stack holds; see loadServerFunctions.
report
readonlyreport: (diagnostic) =>void
Defined in: packages/prismarine/src/command/function/runtime.ts:70
Where a diagnostic goes. The server sends these to its log.
Parameters
diagnostic
Returns
void
Variables
MAX_NESTED_FUNCTION_DISPATCH
constMAX_NESTED_FUNCTION_DISPATCH:64=64
Defined in: packages/prismarine/src/command/function/runtime.ts:40
How deep a /function may nest when the nesting goes back through the dispatcher rather than through the executor's own queue.
A function line inside a function is control flow the executor reads itself, so it stays on the executor's heap-allocated frame stack and is bounded by maxCommandSequenceLength. execute ... run function is not: it is a command, so it re-enters this runtime through a command body and each level costs real JavaScript stack. Java has no such split, because its ExecutionContext carries both, so this cap exists only to keep a mutually recursive pack from overflowing the host stack before the operation limit can stop it.