Scriptclass
A reusable script created by `Sandbox.Game.Scripting`. Arguments expire after each invocation; local variables are fresh each run. Use sequentially on the owning context's thread.
Methods6
Showing 6 methods
public bool Compile()
Checks that the script compiles with its supplied arguments without executing it. Arguments remain available for the next Run. Failure sets LastError.
bool—public bool HasArgument(string name)
Whether this script references a named external argument. Use before supplying optional host inputs. Names are case sensitive; locals do not count as external arguments.
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
bool—public bool Run(int instructionLimit = 10000000)
Runs the script, returning false and setting LastError on failure.
| Parameter | Type | Description |
|---|---|---|
| instructionLimit = 10000000 | int | — |
bool—public T RunAndReturn(int instructionLimit = 10000000)
Runs the script and reads its result. Returns default on failure or when no value is returned. An incompatible return type is reported through LastError.
| Parameter | Type | Description |
|---|---|---|
| instructionLimit = 10000000 | int | — |
T—public void SetArgument(string name, T value)
Supplies a named input for the next invocation only. Unknown names and changes during execution are API usage errors. Supply every input needed to bind host member calls before running.
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
| value | T | — |
void—public Sandbox.ScriptInvocation`1<T> With(string name, T value)
Creates a stack-only invocation with a temporary argument. Chain With to supply more arguments, then call Run or Compile. Names must be referenced by the script; repeated names replace earlier values.
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
| value | T | — |
ScriptInvocation<T>—No results match this filter.
Properties1
Showing 1 properties
public Sandbox.Script.ScriptError Sandbox.Script.LastError { get; set; }
The most recent failure, or null after a successful invocation.
No results match this filter.