ScriptSystemclass

Creates scripts in the current menu or game context. Identical source shares cached code, while each script has independent arguments and execution state.

object→ScriptSystem
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.ScriptSystem

Methods4

Showing 4 methods

public Sandbox.Script.Analysis Analyze(string source, System.Collections.Generic.IEnumerable`1<Sandbox.Script.Input> inputs = null)PUBLIC

ParameterTypeDescription
sourcestring—
inputs = nullIEnumerable<Input>—
Returns:Analysis—

public Sandbox.Script CreateScript(string source, Sandbox.ScriptStore locals = null)PUBLIC

Creates a reusable script. Syntax and execution errors are reported through `Sandbox.Script.LastError`. Binding and IL compilation occur on the first run, once arguments are available. Supply a local store to share persistent fields or preserve them across source edits. If omitted, the script receives its own local store.

ParameterTypeDescription
sourcestring—
locals = nullScriptStore—
Returns:Script—

public Sandbox.ScriptStore CreateStore()PUBLIC

Creates an independent store. Share it between scripts belonging to the same owner.

Returns:ScriptStore—

public T Run(string source)PUBLIC

Runs a script using cached code and returns its value. Throws if execution fails, no value is returned, or the return type is incompatible with .

ParameterTypeDescription
sourcestring—
Returns:T—

Properties1

Showing 1 properties

On this page