Skip to content

Getting Started

liu.yandong.hanks edited this page Aug 23, 2026 · 5 revisions

Getting Started

Install AuroraScript.JIT, compile your first module, and call it from a .NET host.

Applies to 4.0.0.

Home · Host Integration · Language Guide

Installation

Install the NuGet package in the .NET host project:

dotnet add package AuroraScript.JIT --version 4.0.0

The package targets net8.0, net9.0, and net10.0. Dynamic and OnlyRun work on all three targets; Persistence requires net9.0 or later.

Your First Module

First create scripts/main.as. This entry declares @module(MAIN); because the host will execute it by name; when present, @module must be the first effective statement.

@module(MAIN);

export func main(value) {
    return value + 22;
}

Then create the engine, build the script, create a domain, and execute the exported function.

using AuroraScript;
using AuroraScript.Core;
using AuroraScript.Runtime;

var options = EngineOptions.Default
    .WithCompiler(compiler =>
    {
        compiler.SourceResolver = ScriptSources.FileSystem("./scripts");
        compiler.Mode = CompilationMode.Dynamic;
    });

var engine = new AuroraEngine(options);
await engine.BuildAsync("main.as");

using var domain = engine.CreateDomain();
var result = domain.Execute("MAIN", "main", ScriptDatum.FromNumber(20));
Console.WriteLine(result); // 42

AuroraEngine owns configuration and compilation; ScriptDomain is an isolated execution environment with its own global object and module instances.

Files used only through import or include may omit @module. They remain anonymous and are identified by their resolved full source path; AuroraScript does not derive a default module name from the filename. A script can dynamically query an already loaded, explicitly named module with global.getModule("NAME"); static dependencies should still use import.

Next steps

Clone this wiki locally