Skip to content

API Host BondingGetter

Liu.Yandong.Hanks edited this page Aug 21, 2026 · 3 revisions

BondingGetter

Script object wrapper for a ClrGetterDelegate.

Namespace: AuroraScript.Runtime.Types. Kind: class.

Back to .NET Host API Reference

Overview

BondingGetter exposes a host-computed value as a script property. Each read calls the wrapped ClrGetterDelegate, which writes into the ref result slot, so the value can be produced on demand instead of stored.

Quick Reference

A minimal use of BondingGetter.

ClrGetterDelegate answer = (
    ScriptObject target,
    ref ScriptDatum result) =>
{
    result = ScriptDatum.FromNumber(42);
};

var getter = new BondingGetter(answer);

Constructors

BondingGetter

BondingGetter(ClrGetterDelegate callback)

Wraps a host getter delegate as a script-readable value.

Parameters

Name Type Required Description
callback ClrGetterDelegate Yes Callback invoked by the runtime on each read.

Returns

A new BondingGetter instance.

var getter = new BondingGetter(answer);

Fields

Name

string Name

Getter name reported to scripts.

Parameters

None.

Returns

Returns string.

Console.WriteLine(getter.Name);

Methods

Invoke

void Invoke(ScriptObject @object, ref ScriptDatum result)

Invokes the wrapped getter for the supplied object.

Parameters

Name Type Required Description
object ScriptObject Yes Object the property is read from.
result ref ScriptDatum Yes Slot receiving the read value.

Returns

None.

Behavior

The runtime normally calls Invoke on property access; a host calls it directly only when reading the value outside script execution.

var result = ScriptDatum.Null;
getter.Invoke(hostObject, ref result);

Clone this wiki locally