Wren.NET 1.1.0

dotnet add package Wren.NET --version 1.1.0
                    
NuGet\Install-Package Wren.NET -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Wren.NET" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Wren.NET" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Wren.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Wren.NET --version 1.1.0
                    
#r "nuget: Wren.NET, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Wren.NET@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Wren.NET&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Wren.NET&version=1.1.0
                    
Install as a Cake Tool

Wren.NET

Logo

C# .NET Core 9.0 Lua.NET contains full bindings to Wren

https://github.com/tilkinsc/Wren.NET
Copyright © Cody Tilkins 2025 MIT License

Notable Changes:

  • 1.0.2 - Doc Comments
  • 1.0.1 - Correct native string (for non-windows users)
  • 1.0.0 - Initial Release

Example Usage:

using System.Text;
using WrenNET;
using static WrenNET.Wren;

class Program
{
	public static string RootDir = Directory.GetCurrentDirectory();
	
	public static void WriteFn(WrenVM vm, string text) =>
		Console.Write(text);

	public static string? MainModule = string.Empty;
	public static readonly Dictionary<string, string> ModulePaths = [];
	
	public static void ErrorFn(WrenVM vm, WrenErrorType errorType, string module, int line, string msg)
	{
		Console.WriteLine($"Module: {module}");
		if (string.IsNullOrEmpty(module))
		{
			module = MainModule!;
		}
		else
		{
			ModulePaths.TryGetValue(module, out var pathHint);
			if (!string.IsNullOrEmpty(pathHint))
			{
				module = pathHint;
			}
		}
		switch (errorType)
		{
			case WrenErrorType.WREN_ERROR_COMPILE:
				Console.WriteLine($"{module}:{line}:1: [error] {msg}");
				break;
			case WrenErrorType.WREN_ERROR_STACK_TRACE:
				Console.WriteLine($"{module}:{line}:1: [trace] {msg}");
				break;
			case WrenErrorType.WREN_ERROR_RUNTIME:
				Console.WriteLine($"[runtime error] {msg}");
				break;
		}
	}
	
	public static WrenLoadModuleResult LoadModuleFn(WrenVM vm, string module)
	{
		string path = Path.Combine(RootDir, module.Replace('.', Path.DirectorySeparatorChar) + ".wren");
		if (!File.Exists(path))
		{
			return new WrenLoadModuleResult { source = null };
		}

		ModulePaths[module] = Path.GetFullPath(path);
		string source = File.ReadAllText(path, Encoding.UTF8);
		return new WrenLoadModuleResult { source = source };
	}
	
	public static void Main(string[] args)
	{
		if (args.Length == 0)
		{
			Console.WriteLine("Usage: dotnet run <script.wren>");
			return;
		}
		
		string entryPath = Path.GetFullPath(args[0]);
		if (!File.Exists(entryPath))
		{
			Console.WriteLine($"File not found: {entryPath}");
			return;
		}
		
		RootDir = Path.GetDirectoryName(entryPath)!;
		
		string entrySource = File.ReadAllText(entryPath, Encoding.UTF8);
		string moduleName = Path.GetFileName(entryPath);
		MainModule = moduleName;
		
		WrenConfiguration config = new();
		wrenInitConfiguration(config);
		config.writeFn = WriteFn;
		config.errorFn = ErrorFn;
		config.loadModuleFn = LoadModuleFn;
		
		WrenVM vm = wrenNewVM(config);
		
		WrenInterpretResult result = wrenInterpret(vm, moduleName, entrySource);
		Console.WriteLine(result.ToString());
		
		wrenFreeVM(vm);
	}
}

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 141 6/5/2025
1.0.2 94 6/1/2025
1.0.1 98 6/1/2025
1.0.0 118 5/23/2025