-
Notifications
You must be signed in to change notification settings - Fork 0
API Host ClrDatumDelegate
直接操作 ScriptDatum 的原生宿主函数高级委托签名。
Advanced delegate shape for native host functions that operate directly on ScriptDatum values.
命名空间:AuroraScript.Runtime.Types。类型:delegate。
Namespace:
AuroraScript.Runtime.Types. Kind: delegate.
Purpose
ClrDatumDelegate 是公开宿主类型。通过下方签名选择调用方式;对运行时对象、生命周期和异常,应由宿主在边界处明确处理。
Advanced delegate shape for native host functions that operate directly on ScriptDatum values.
Simple Example
下面是 ClrDatumDelegate 的最小使用方式。
A minimal use of
ClrDatumDelegate.
ClrDatumDelegate answer = (
ScriptContext ctx,
ScriptObject module,
Span<ScriptDatum> args,
ref ScriptDatum result) =>
{
result = ScriptDatum.FromNumber(42);
};Members
调用 Invoke 完成其公开操作。
Use the member according to its public signature.
Parameters:
-
ctx
当前脚本执行上下文。Current script execution context.
-
module
要关联或执行的脚本模块。Script module to associate or execute.
-
args
传给脚本或回调的实参数组。Argument array passed to a script or callback.
-
result
接收调用结果的变量。Variable receiving the call result.
Returns
无。
None.
调用示意
以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。
The example shows the call shape; replace placeholder instances and arguments with actual host values.
ClrDatumDelegate value = /* 从宿主 API 获取实例 */;
value.Invoke(/* ctx */, /* module */, /* args */, /* result */);AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License