-
Notifications
You must be signed in to change notification settings - Fork 0
API Host ClrType
Script-visible wrapper for a registered CLR type.
Namespace: AuroraScript.Runtime.Interop. Kind: class.
Back to .NET Host API Reference
ClrType is the descriptor a script sees after a CLR type has been registered under an alias. It carries the access policy chosen at registration time, so construction and static-member access follow the TypeAccess value the host supplied.
Note
Hosts normally obtain this through AuroraEngine.RegisterType or ClrTypeRegistry.TryGetClrType.
A minimal use of ClrType.
engine.RegisterType<DateTime>("HostDate", TypeAccess.Constructor);
if (engine.ClrRegistry.TryGetClrType("HostDate", out var type))
{
Console.WriteLine(type);
}void Construct(ScriptContext ctx, Span<ScriptDatum> args, ref ScriptDatum result)Constructs a CLR instance when constructor access is allowed.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ctx |
ScriptContext |
Yes | Active script execution context. |
args |
Span<ScriptDatum> |
Yes | Constructor arguments. |
result |
ref ScriptDatum |
Yes | Slot receiving the constructed instance. |
Returns
None. The constructed instance is written to result.
Behavior
Construction requires TypeAccess.Constructor or TypeAccess.All at registration; the runtime normally calls this on new in script code.
engine.RegisterType<HostCalculator>("Calculator", TypeAccess.Constructor);
if (engine.ClrRegistry.TryGetClrType("Calculator", out var descriptor))
{
var instance = ScriptDatum.Null;
descriptor.Construct(context, Span<ScriptDatum>.Empty, ref instance);
}AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License