-
Notifications
You must be signed in to change notification settings - Fork 0
API Host ScriptGlobal
Liu.Yandong.Hanks edited this page Aug 21, 2026
·
3 revisions
Global object for one domain
Back to .NET Host API Reference
ScriptGlobal is the main entry point for exposing values, delegates, and objects to scripts. Define sets writability and enumerability; SetPropertyValue updates existing or dynamic global members.
AuroraEngine EngineReturns
Owning AuroraEngine.
// Given a configured AuroraEngine named engine:
var global = engine.NewEnvironment();
Console.WriteLine(ReferenceEquals(global.Engine, engine));Defines a host value, ScriptDatum, ScriptObject, or delegate on the global object.
void Define(string key, object value, bool writeable = true, bool enumerable = true)void Define(string key, ScriptDatum value, bool writeable = true, bool enumerable = true)void Define(string key, ScriptObject value, bool writeable = true, bool enumerable = true)Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key |
string |
Yes | Script name. |
value |
object / ScriptDatum / ScriptObject |
Yes | CLR object, ScriptObject, or ScriptDatum. |
writeable |
bool |
No | Whether scripts may write it. |
enumerable |
bool |
No | Whether it participates in enumeration. |
Returns
None.
// Given a configured AuroraEngine named engine:
var global = engine.NewEnvironment();
global.Define("HOST_ADD", (Func<int, int, int>)((left, right) => left + right));
global.Define("BUILD", ScriptDatum.FromNumber(4), writeable: false, enumerable: true);void SetPropertyValue(string key, object value)void SetPropertyValue(string key, ScriptObject value)Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key |
string |
Yes | Global name to update. |
value |
object / ScriptObject |
Yes | CLR object or ScriptObject. |
Returns
None.
// Given a configured AuroraEngine named engine:
var global = engine.NewEnvironment();
global.SetPropertyValue("REQUEST_ID", "r-42");when scripts need static diagnostics and completion, create a @global(); declaration file rather than redefining host globals in script.
AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License