-
Notifications
You must be signed in to change notification settings - Fork 0
API Host ScriptType
脚本可见类型构造对象的高级抽象基类。
Advanced abstract base for script-visible type constructor objects.
命名空间:AuroraScript.Runtime.Types。类型:class。
Namespace:
AuroraScript.Runtime.Types. Kind: class.
ScriptType 是公开宿主类型。通过下方签名选择调用方式;对运行时对象、生命周期和异常,应由宿主在边界处明确处理。
Advanced abstract base for script-visible type constructor objects.
注意
大多数宿主代码应通过 AuroraEngine.RegisterType 公开 CLR 类型,而不是继承 ScriptType。
Most host code should expose CLR types through AuroraEngine.RegisterType instead of subclassing ScriptType.
下面是 ScriptType 的最小使用方式。
A minimal use of
ScriptType.
// 宿主通常注册 CLR 类型,而不是继承 ScriptType。
engine.RegisterType<DateTime>("HostDate", TypeAccess.Constructor);读取 Name 字段。
Use the member according to its public signature.
Parameters:
- 无。
None.
Returns
返回 string。
Returns
string.
调用示意
以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。
The example shows the call shape; replace placeholder instances and arguments with actual host values.
ScriptType value = /* 从宿主 API 获取实例 */;
var current = value.Name;调用 Construct 完成其公开操作。
Use the member according to its public signature.
Parameters:
-
ctx
当前脚本执行上下文。Current script execution context.
-
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.
ScriptType value = /* 从宿主 API 获取实例 */;
value.Construct(/* ctx */, /* args */, /* result */);AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License