Skip to content

API Host CompileBlockOptions

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

CompileBlockOptions

Options for compiling a lightweight script block.

Namespace: AuroraScript. Kind: class.

Back to .NET Host API Reference

Overview

CompileBlockOptions defines the positional parameter names of a block and the virtual source name used in diagnostics.

Important

A block accepts a statement body only; it cannot contain @module, @global(), import, include, export, or declare.

Quick Reference

A minimal use of CompileBlockOptions.

using var block = engine.CompileBlock("return left + right;", new CompileBlockOptions
{
    Parameters = ["left", "right"],
    SourceName = "rules/sum.as"
});

Properties

Parameters

IReadOnlyList<string> Parameters

Names of positional arguments exposed as local variables.

Parameters

None.

Returns

Returns IReadOnlyList<string>.

Behavior

Names cannot be empty, duplicate, or use global, $args, or $state.

var options = new CompileBlockOptions { Parameters = ["left", "right"] };

SourceName

string SourceName

Virtual source name used in diagnostics.

Parameters

None.

Returns

Returns string.

var options = new CompileBlockOptions { SourceName = "rules/discount.as" };

Clone this wiki locally